New Issue: Orbital Catastrophe Ahead? Read Now

How Many Candies Are in That Jar?

Researchers have developed a new model that can estimate the number of objects randomly packed together

Join Our Community of Science Lovers!


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


Counting cards at the casino may pay out more than counting candies in a jar, although a close goodie guesstimate could still win you a sweet prize at the county fair. But just how do you estimate a figure for all the candies you can't see in the inner part of the jar, especially if they vary in size?

Researchers at New York University (N.Y.U.) may finally have the answer to this classic mathematical puzzle. Using transparent, fluorescently labeled oil droplets in water, the physicists looked beyond the outermost layer of spherical particles within the container—the only layer visible when looking from the outside—to spy on the geometric behavior inside. The resulting formula, which simply requires the sizes of the particles and the container as inputs, could make fair officials nervous.

"You give us the distribution of sizes, and we can tell you how it will pack," says Jasna Brujic, who led the project.

Brujic and her colleagues at N.Y.U.'s Center for Soft Matter Research used their 3-D oil–water model to determine that bigger particles, when packed in a container holding a combination of sizes, made more contacts with neighbors than smaller ones. That much was intuitive, Brujic says, given their larger surface area. What was more surprising was that the average number of contacts for a particle within any mixed container was always six. This number, she explains, maintains mechanical stability.

The researchers also knew from previous work that randomly packed identical spheres fill up about 64 percent of the volume in a given container. But Brujic's team was the first to describe how that proportion, or density, grows when the spheres vary in size; smaller ones can fill in voids that larger ones can't.

So, what should a contestant do if he or she wants to guess at the number of candies in a jar, but lacks the complicated formula and a handy computer? "First, estimate the size of the jar," instructs Brujic. "Then look to see if all the candies are the same size. If they are, take 64 percent of that volume and divide it by the size of the candy to get the total number that would randomly fit inside. If they aren't equally sized, divide a slightly larger area, around 70 percent, by the average size of the candies."

The team's experiments were all based on spherical particles, so Brujic notes that corrections are needed when generalizing to other shapes. Counting jellybeans would be more complicated than gumballs, for example.

The applications for this finding extend well beyond the fairgrounds—ranging from aiding oil extraction to filling vending machines to creating a paint that dries faster or a pill that is easier to swallow. Brujic, however, returns to the candy model with her big business idea: "If you want to make the most money as a sweet-maker, you could tune the size distribution to get a small density," Brujic says. Or, for the more generous candy-maker, the reverse could work: "If you are a Charlie and the Chocolate Factory manufacturer, you could find a way to fit the most chocolates in your bag." She is considering asking confectioner Mars, Inc., for her next grant.

The study was published in the latest issue of the journal Nature. (Scientific American is part of the Nature Publishing Group.)

Subscribe to Support Independent Journalism

Great science journalism requires human expertise, time, effort and creativity. And it costs money. That’s why I and the journalists here at Scientific American hope you’ll join our community.

When you subscribe, you are supporting staff and freelance journalists who are passionate about telling science stories that are true, important and compelling. Our editors and reporters are often experts in their fields, which means they understand the nuances of big discoveries and can untangle the breakthroughs from the hype. With a subscription, you are also supporting rigorous fact-checking to ensure the words we publish are precise and accurate. And you’re supporting original illustrations, graphics and photos that bring you closer to an advanced laboratory, an ice sheet in Antarctica or a space mission in orbit. You’re helping us craft other types of high-quality journalism as well: Our newsletters are carefully written, edited and curated by staffers you have or will come to know and love. Our Science Quickly podcast is based on original reporting, collaboration with editors and scientists and exacting production.

Subscriptions keep this engine running so we can continue to deliver thoughtful, rigorous and independent science journalism to you. In an era of viral misinformation, this work is crucial. If you value what we do, I hope you’ll consider joining us as a subscriber

Thank you,

Jeanna Bryner, Editor in Chief, Scientific American

Subscribe