There are multiple ways of coming to the solution, such as blind guessing, getting an identical jar and counting how many jellybeans it takes to fill that up, or using math to determine the jar's volume and the volume of a single jellybean. In the world of fiction, it's a good premise for an episode, or at the very least, a gag, wherein the characters try to figure out the central question.
"How many jellybeans (or whatever the item is) are in the jar?"
- Disney Ducks Comic Universe: One story had Donald and Gladstone both participate in a contest like this, with regular beans instead of jellybeans, organized by a travel agency. Gladstone just made a random guess, while Donald went so far as to purchase a similar jar as the one in the contest, fill it up with beans, and count them...and concluded that Gladstone had guessed exactly the right number. Donald then tried to sabotage the contest by having a bird eat some of the beans, but Gladstone still won since one of the beans germinated, and the resulting plant provided enough beans to make up for the ones the bird had eaten.
- Superman once used "super-mathematics" to determine the amount of beans in a jar by knowing the weight of one bean and the weight of the jar. The legitimacy of this power is somewhat questionable; not only is this just simple multiplication, but Superman got the answer wrong by a factor of 10 too high, ignoring the rounding errors.
- An issue of The Simpsons features one, which Bart and Lisa try to win. Despite Lisa's calculations, they fail, but Homer wins it by just happening to say the correct number while he's nearby. When the jar is emptied, Lisa finds out why she didn't get it right - one of the jellybeans was much bigger than the others.
- In a Nancy strip from the '70s, the titular character is staring at a jar full of beans in a store to figure out how many there are. She then gets a flash of insight, and runs into the store to claim the cash prize. How many beans in the jar? None!! (As a wide, final panel depicts the now-empty, tipped-over jar, courtesy of the store's cat.)
- Total Trauma: In the three-part Breather Episode ""Jellybean Warfare," Courtney tests her math whiz girlfriend Cecily by having her guess the number of jellybeans in a jar. Shockingly, Cecily gets the exact number right, but Courtney eats some of the jellybeans to try and claim she was a few beans off. Cecily knows better though, and chases down Courtney, who refuses to kiss her lest Cecily taste jellybeans on her lips.
- Counting on Frank features a local club that has one of these with a trip to Hawaii as a prize. Because the book's protagonist is especially skilled at math and estimation, he wins easily.
They didn't know who they were dealing with.
- The Six Bullerby Children: Lasse, Bosse and Lisa organize a Christmas contest for everybody in Bullerby. Whoever guesses right the number of peas in a jar wins their prize which is a huge piece of gingerbread.
- One Encyclopedia Brown case has one of these in its backstory. The case itself focuses on how the kid who won the contest had his prize stolen by Bugs Meany.
- Polk Street School: Book #3 of the original series is The Candy Corn Contest, revolving around one of these but with candy corn instead of jellybeans, with the winner receiving the contents of the jar. Richard "Beast" Best really wants to win, and can't stop himself from both sneaking a peek at the winning number (which is written on the bottom of the jar) and actually swiping a few pieces from it before the end of the contest.
- In The Brady Bunch episode "The Tattle-Tale" (s2e10), Alice is found counting jellybeans in the kitchen, to approximate the number of beans for a store contest.
- The Corner Gas episode "Bean There" had this as an A-plot, but Brent, Karen and Emma had trouble counting the beans for the contest, so they had to estimate it for themselves and keep the townsfolk from knowing they're making stuff up.
- iCarly: The school has a contest involving guessing how many Fat Cakes were in a jar, all to win the largest locker in school. Freddie did complicated math, while Sam just guessed because "Mama knows her Fat Cakes". They were both correct, and they both had to share the locker. Gibby guesses five.
- An episode of Monk had the title character go to a carnival as part of an investigation with Sharona and Benji. It turned out they were having one of these. Monk tells Benji to guess a certain number (without actually seeing the jellybeans) and he wins. He explains at episode's end that he actually saw the boxes for the jellybeans, multiplied the number of boxes by the normal amount in the box, and subtracted a few to account for the proprietor eating some.
- In one episode of The Middle, Patricia Heck gives an idea to her boss to pull one of these contests, only that the beans fill the interior of a car and the car is the prize. It ends up going horribly wrong: after being so long under the sun, all of the beans melt together into a gigantic block of candy, making the vehicle utterly impossible to give away, let alone sell.
- The Office: This was one of the various bets happening in the episode "Safety Training".
- The Tonight Show Starring Jimmy Fallon had one of these on the "Wheel of Game Shows", with the twist that there were hardly any jellybeans in the jar at all.
- In the Broad City episode "Working Girls," the temping agency where Ilana briefly works has a large jar of candies with the label "Guess how many and win!" Ilana doesn't see the label and eats dozens of the candies, forcing her boss to count them again.
- The video game version of Counting On Frank expanded on this from the book, turning it from something that happened offscreen to the premise of the game. The player can't measure the jar in-game, but instead has to gather clues by solving the game's other math problems that the protagonist, now named Henry, and his dog Frank think about while exploring his house, the corner store, and the park between the two places. Get the wrong number, and instead of Henry winning the trip to Hawaii, it goes to his Friendly Rival Ginger.
- The Adventures of Jimmy Neutron: Boy Genius: In the episode "Sheen's Brain", after Jimmy increases Sheen's brainpower, Sheen uses his newfound intelligence to accurately solve one of these. However, Sam refuses to give him the prize as he refuses to believe Sheen could guess the correct answer without cheating.
Sheen: I said give me my free sundae!
Sam: And I said there's no way you could've known there were 12,082 beans in that jar without cheating, yeah!
Sheen: I told you, I used a complex algorithm, based on the dimensions of the jar!
Sam: Uh-huh. Yesterday, you thought seashells were money. Today you're using algorithms?
Sheen: Yesterday, I wasn't a genius! Now, give me my ice cream, monkey boy!
- Ben 10: In "The Unnaturals", Ben as Gray Matter is launched into a jar of jellybeans, after stopping a pair of criminals on a truck. The beans are for a contest to win an MP3 player, which Grey Matter is easily able to win.
- Curious George: One episode of the PBS series revolves around a gumball machine full of toy bouncing balls. Betsy (with George's help) wins the contest by filling a hat box with similar-sized golf balls. Steve's method of multiplying and dividing the different colors proves...less reliable.
- DuckTales: In the "Super DuckTales" story arc, Fenton Crackshell (who can count any quantity in a second) challenges the Master Electronic Leader to a series of these to prove whether or not robots are superior to organic life. Fenton won each time, able to count the number of ball-bearings in jars faster than the supercomputer M.E.L. For the last round, Fenton challenged M.E.L. to count the bolts, but it's a trick, as the jar was full of nuts, not bolts.
- George of the Jungle: One episode has Howie the howler monkey doing a contest to see how many ticks there are in a jar. Ape was in the middle of saying his guess, only for Howie to tell him the contest was over and that he won. Turns out the "contest" was just a way for Howie to get rid of his jar of ticks, which Ape mistakes for an incident of good luck thanks to a pair of underpants.
- An episode of The Little Lulu Show focused on this, and Lulu and her friends got to the solution by getting an identical jar, filling it with jellybeans, and counting them as they emptied the jar. They gave themselves a stomachache in the process, and unfortunately, the prize was the jar of jellybeans.
- Such a contest is held in a mall in the Ned's Newt episode "Mall Good Things Come to an End", with a drivable toy car as a prize. It turns out that the mall's security guard has been spending his nights counting the jellybeans by hand, in order to win the car for himself.
- In the Phineas and Ferb episode "We Call It Maze", it's not a contest, but one of the many puzzles in the titular maze made by a computer. The jar was placed next to a door, that would open when the correct number of jellybeans was inputted. While Phineas and Baljeet were debating which units of measure to use to calculate the correct number, Buford gets impatient and opts to eat all the jellybeans and enter "0". It worked, though Baljeet called him out for cheating.
- In one episode of Sid the Science Kid that has estimation as its central theme, Sid's grandmother tells him the story about how she won this kind of contest when she was young. After analyzing the jar closely, she won the contests due to her estimation being the closest to the actual number of jellybeans, merely one jellybean difference. In the same episode, they play the same game at the family dinner with meatballs and she wins again.
- In the SpongeBob SquarePants episode "For Here or to Go", Mr. Krabs holds a contest, wherein anyone who guesses the correct number of bun seeds in a jar wins a free Krabby Patty. Plankton, who is trying to steal the Krabby Patty secret formula, correctly guesses that there are 500,301 bun seeds, and when Mr. Krabs refuses to give him a Krabby Patty, Plankton calls the Bogus Business Bureau on him. The BBB threatens to shut down the Krusty Krab unless Mr. Krabs gives Plankton his Krabby Patty. Plankton wins but Krabs turns it around on him by forcing him to eat the patty before leaving, which ruins his attempt to analyze and replicate it.
- As stated in the opening sentence, this trope is popular at fairs, fundraisers, and sometimes math classes.
- In some Southern jurisdictions of the United States, "literacy tests" (read: excuses for banning Blacks from voting without running afoul of the Fifteenth Amendment) included such questions as this trope.