If you've ever wondered how many grains it takes to top off a salt shaker or why a new box of cereal often arrives half empty, step into the Princeton University laboratory of Salvatore Torquato and Paul Chaikin.

The researchers have spent more than 15 years pondering one of the oldest and most elemental riddles in mathematics: What's the best way to cram the most amount of stuff into the least amount of space?

They're called packing problems. Since mathematicians started working on them 400 years ago, they have played a role in scientific endeavors that range from the study of human cells to the design of high-speed computer modems.

Now the Princeton researchers and their students have overturned a centuries-old assumption at the heart of most packing problems. And they did it by turning to an unlikely source for inspiration: M&M;'s.

For centuries, mathematicians have used the sphere as a stand-in for human cells, corn kernels, grains of sand and other real-world objects modeled in their packing equations. But it turns out spheres might not be as ideal as scientists thought.

After using computer simulations and tens of thousands of M&M;'s, the Princeton team knows that that the candy not only melts in your mouth but also packs more densely in your hand than a spherical candy, such as a gum ball.

Their report, in the current issue of Science, could lead to everything from advanced new manufacturing materials to more economical ways of packing and shipping goods, said Torquato.

Economics is one of the reasons scientists became interested in packing. "It's an ancient problem," says Torquato. For thousands of years, people settled debts and paid their taxes with a sack of grain or salt. Shrewd merchants knew enough to give the sack a good shaking before they accepted it as payment.

But what merchants knew instinctively - that rearranging particles causes them to jam together more tightly-didn't seriously enter the minds of mathematicians until the 16th century.

According to Swiss journalist and mathematician George Szpiro, an unlikely figure helped launch the modern mathematical study of packing - the English nobleman and adventurer Sir Walter Raleigh. As the story goes, Raleigh was provisioning his ship when he noticed a pile of cannonballs on deck. He pulled aside a mathematician on his payroll and asked: Was it possible to calculate how much ammunition he had in each pile, based solely on its shape and size?

The mathematician solved the problem in 1591 but then tackled a far more difficult question: What arrangement of cannonballs in the ship's hold would result in the least wasted space?

At one point, he communicated with the great German mathematician and astronomer Johannes Kepler, best known today for his three fundamental laws of planetary motion.

In The Six-Cornered Snowflake, a 24-page treatise on snow crystals published in 1611, Kepler offhandedly proposed a solution to the cannonball question. The most efficient method for arranging spheres is the way a grocer stacks oranges - in a pyramid. In mathematical terms, it's called face-centered cubic packing.

It took mathematicians 387 years to prove that the theory - known as the Kepler Conjecture - was correct. By carefully stacking cannonballs in the ship's hold as Kepler proposed, Raleigh could fill slightly more than 74 percent of the space with ammunition. Space between the balls would account for the rest of the volume.

In real life, most objects aren't packed neatly but tossed willy-nilly into a container. So mathematicians soon began to wonder: How efficiently can randomly packed spheres be crammed together?

They determined that no matter how they were jostled, tamped or stirred, randomly packed spheres could occupy no more than 64 percent of a defined space.

Enter the M&M.;

In the 15 years that Torquato and Chaikin had been working on packing, they had concentrated on spheres, experimenting with objects that ranged from ball bearings to marbles. ("Even couscous," Torquato says.)

Finally they wondered whether a more elliptical shape might pack better. Looking for a cheap and readily available supply of elliptical objects, they turned to the department's vending machine. After briefly evaluating the suitability of Skittles, the team settled on plain milk chocolate M&M;'s, which have a round face but an elliptical cross-section.

"An M&M; is nothing more than a squashed sphere," says Torquato. More precisely, an M&M; is an oblate spheroid.

Another reason for picking M&M;'s was personal: M&M;'s and coffee have been Chaikin's lunch for the past two decades.

With several hundred dollars worth of plain and mini-M&M;'s in hand, the scientists set to work. To determine the candies' packing density, Torquato and Chaikin filled a plastic five-liter flask with the candies. Each time the candies reached the brim, the researchers jiggled the container until the M&M;'s settled. Then they put in more.

When no more would fit, the scientists calculated how densely the candies were crammed, using the volumes of both the container and a single M&M; to figure the answer.

Each five-liter flask, it turned out, held roughly 7,500 regular M&M;'s or 23,000 minis. More importantly, the M&M;'s filled 68 percent of the container - four percentage points more than the randomly packed ball bearings would. A computer simulation showed that if they flattened the M&M; shape a bit, they could have packed in more.

"It's a startling and wonderful result," said Sidney Nagel, a physicist and packing expert at the University of Chicago.

To prove that the M&M;'s were arranged randomly, the scientists carried the candy-filled flask to Princeton Hospital for an MRI. Looking at the image afterward, Torquato and his team joked to hospital technicians: "This is what a physicist's brain looks like."

The Princeton team says the M&M; study might have practical applications. Advanced ceramics, a component of electronics key to aircraft engines, are made by compacting small particles. Making the particles more elliptical, the scientists said, could reduce the empty space between particles and make the ceramic stronger.

The only downside to the research, said Torquato, was that the people involved conducted too many informal studies of M&M; mouth packing. "They're a lot fatter," he said.