Beguilingly simple and yet painfully, frustratingly complex at the same time, there are few things in mathematics as fascinating as the primes: numbers that cannot be divided by any integers except themselves and one. And, as with so much in number theory, the scariest problem of all is one that sounds, on the face of it, almost childishly straightforward: what pattern – if any – do the prime numbers follow?

It's not an easy question. Since Eratosthenes first invented his sieve back in the 3rd century BCE, some of the greatest mathematical minds have thrown up their hands and declared it unanswerable. The best we've got is the famous Riemann hypothesis, which says that the primes follow a pattern closely related to the Riemann zeta function. The hypothesis may well be true – many mathematicians, often a romantic bunch, feel it's just too beautiful *not* to be true – but in the 160 years since Riemann first proposed it, nobody has yet been able to come up with a proof.

But maybe all is not lost. A new analysis from researchers in the departments of chemistry, materials science, and mathematics at Princeton University has revealed something amazing: a level of order in the primes that nobody knew anything about until now. Their results are published in the Journal of Statistical Mechanics: Theory and Experiment.

"We showed that the primes behave almost like a crystal," explained lead researcher Salvatore Torquato in a statement about the discovery. "[M]ore precisely, similar to a crystal-like material called a ‘quasicrystal.’"

Now, quasicrystals are structures like crystals, but without translational symmetry – the patterns of their atomic arrangements will never repeat. In very crude terms, it looks like a crystal, but only if you squint.

The discovery of quasicrystals in 1982 by materials scientist Dan Shechtman was marked by some incredible controversy. But despite being ridiculed by his peers as a "quasi-scientist" and told he had become "a disgrace", his work on the "impossible" structures proved so significant that he was awarded the Nobel Prize in Chemistry in 2011. Since then, quasicrystals have promised advances on everything from frying pans to real-life *Terminator* robots – and now, Torquato and his colleagues say we can add prime numbers to that list.

The key is something called hyperuniformity. This somewhat brain-twisting property has been found in situations as diverse as the retinal cells of chickens or the large-scale structure of the universe since it was first observed in the early 2000s – and Torquato's team has shown it applies to the Riemann hypothesis as well. Put crudely, it refers to when seemingly random things turn out to have a kind of hidden order – for instance, imagine a bag of trail mix: if you inspect each grain or cashew individually, you're not going to see a pattern. But scale it up to a family-size pack in the store, and you can see a sort of sense: the random vibrations and bumps have shaken the particles serendipitously into an arrangement that fits every nook and cranny almost perfectly. And it's that "zooming out" technique that explains the Princeton team's result.