Prime numbers are the most fundamental objects in mathematics, and wrangling them involves a paradoxical blend of simplicity and complexity that has become a lifelong obsession for James Maynard, one that has consumed him to the point where he sometimes strips everyday life of all distractions.

Maynard, who is the Professor of Number Theory at the Mathematical Institute in Oxford, revealed some of his creative secrets last week during the fourth public lecture for the Institute in the Science Museum’s IMAX theatre, following in the footsteps of earlier lectures by Tim Gowers, Roger Penrose and Andrew Wiles.

In a follow up conversation with broadcaster and mathematician Hannah Fry, he described how he was a precocious child who regarded school tests as easy-bordering-on-stupid. He cheerfully admitted to being that annoying kid who endlessly questions the point of everything. ‘I feel terribly sorry for some of my teachers who had to put up with me,’ as he was ‘slightly obnoxious, entitled and independently minded.’

A regular visitor to the Science Museum while he was growing up, he described how he was drawn to prime numbers ‘right from when I was a schoolchild – they are the most fundamental objects in mathematics.’

In his lecture, Maynard explained the fascinations and frustrations of primes, which are only divisible by themselves and one and are often described as the ‘atoms’ of number theory: you can write any other whole number as a product of these prime numbers, so the number 24 is 2 x 2 x 2 x 3, and 110 can be written as 2 x 5 x 11, for example.

Prime numbers are a foundation stone of high tech society: the modern world runs on prime numbers, being critical for encryption (the science of encoding secret messages). For example, the encryption used on almost every debit card, called RSA (named after its inventors, Rivest, Shamir, and Adleman), is based on the properties of prime numbers.

But the main motivation of Maynard is aesthetic. While theories are provisional in science, insights into prime numbers are fundamental and even those uncovered by the ancient Greeks still hold true.

Moreover, by expressing problems in terms of primes, they can be simplified, as was the case with Fermat’s last theorem, he explained, adding that working from the simple to the complex is ‘second nature’ not only for his research but even the way he lives.

However, as he told the audience, ‘even simple questions about primes seem hard’. Questions about the nature of primes that are easy to express have bamboozled mathematicians for centuries, which he admitted is ‘a bit depressing.’

Perhaps the most famous prime number problem is the Riemann Hypothesis, one of seven Millennium Prize Problems, identified by the Clay Mathematics Institute. Each problem carries a $1 million bounty for its solvers and Maynard regards the Riemann Hypothesis as ‘the most open problem in mathematics.’

The hypothesis was unveiled in 1859 by German mathematician Bernhard Riemann, who had noticed that the distribution of prime numbers is closely related to the zeros of an analytical function, which came to be called the Riemann zeta function.

Riemann was trying to understand one of the greatest mysteries in number theory – the pattern underlying prime numbers – and his hypothesis conjectures that the primes are randomly distributed throughout all numbers, so there are clumps of primes as a result. At its most basic, however, Riemann wanted to know how many prime numbers there are which are less than value X.

This conjecture remains unsolved but in 2013 a step towards its proof was announced by Maynard, when he was a postdoc and living in what his Oxford advisors sniffily referred to as ‘the party house’, though Maynard emphasised that this was only by the somewhat staid standards of mathematicians.

HIs advisors also issued Maynard a stern warning ‘not to spend too much time thinking about notorious problems that had been open for hundreds of years.’ He ignored them.

We have known for thousands of years that there are infinitely many primes and there is no discernible pattern in how they are sprinkled along the number line, though they thin out and become rare, even by the time you get to the 100s.

One step towards understanding their distribution came with the twin primes conjecture, which posits that there are infinitely many pairs of primes that differ by only 2, such as 11 and 13 or 5, 7 or 41, 43. As we count higher, infinitely often we should see two primes whose difference is 2.

Understanding these gaps between prime numbers is fundamental to understanding their distribution and Maynard suspected that it might be possible to make progress using a method that had been developed about a decade earlier, even though other mathematicians had written off its potential by then.

Before his approach bore fruit, however, another mathematician, Yitang Zhang, hailed by some as China’s answer to the great self-taught intuitive mathematician Ramanujan, had proved not exactly the twin primes conjecture but that there are infinitely many pairs of primes that are at most a bounded distance apart – to be precise, 70 million.

Although he had been scooped, Maynard found Zhang’s work ‘super exciting’ because it bolstered his hopes of success when using his own approach to understanding prime gaps.

When he wrestles with prime number problems, Maynard admits to getting ‘hyper focused’. That can mean taking a long walk, without his glasses (so as not to be distracted by details) so that he can daydream and, with luck, a solution will swim into his head.

About six months later, Maynard showed there are infinitely many pairs of primes that differ by a gap of at most 600, and which applied not just to pairs of primes, but to triples, quadruples and even bigger collections.

But he admitted that, though he was ‘exceptionally excited,’ his euphoria was tinged with a chilling fear that he had made a mistake in calculations, ‘that it could all come crashing down and I have completely embarrassed myself.’

Any such qualms evaporated when Fields medallist Terence Tao, of the University of California, Los Angeles, came up with similar results in a similar way.

Then Maynard figured out how to address large prime gaps as well, improving upon estimates that had previously seen no significant progress in more than 75 years. Strangely enough, Tao again came up with the same result at roughly the same time, which Maynard said was ‘another crazy coincidence’ and became a running joke between the two.

Maynard went on to prove that there are infinitely many primes that do not have any 5s (or indeed any other digit you might choose). The point is that numbers without any 5s are plentiful if you are looking at small numbers but they are vanishingly rare when you start looking at, say, 1,000-digit numbers. Though his first important proof was his favourite, he found this follow up proof ‘one of the funnest.’

Last year, when Maynard was teetering on top of a stepladder decorating his home, a call came in from the International Mathematical Union, which administers the Fields Medal. Though described as the Nobel Prize of mathematics, medallists are even rarer than Nobelists: The Medal is only awarded every four years to four mathematicians under the age of 40.

Maynard oscillated between thinking he had been awarded the medal and dismissing it as a mundane coincidence, such an invitation to join a committee.

When he was eventually told by Zoom that he had won, Maynard immediately thought of the Russian mathematician Grigori Perelman, who in 2006 was offered the Fields Medal for his contributions to geometry and famously declined, stating: ‘I don’t want to be on display like an animal in a zoo.’

Paranoid that he would somehow blurt out a rejection, Maynard told Hannah Fry how he deliberately slowed down his speech to make sure there was absolutely no doubt that he had indeed accepted the medal.

His Fields citation refers to his ‘spectacular contributions’ to analytic number theory, ‘which have led to major advances in the understanding of the structure of prime numbers.’ According to his citation, ‘his work is highly ingenious, often leading to surprising breakthroughs on important problems that seemed to be inaccessible by current techniques.’

Having only recently become a father, Maynard now has to be as thoughtful about creating space in his life for his young son as for his mathematics. ‘I hope I can keep on going,’ he told the IMAX audience. ‘I like to think I have not reached the limits of my ability in mathematics.’