By 1918, the Indian born, self-thought mathematical genius Srinivasa Ramanujan was already making headlines all over the world, recognized as one of the most brilliant mathematicians of his time. He was born into a poor Brahman family and with no formal education. Luckily he came across a couple of textbook maths, and since he didn’t have enough material, Ramanujan had to find solutions to problems on his own.

While still a teenager, Ramanujan independently stated 6,165 theorems, some already known to Western mathematicians, others completely new.

In 1914 he arrived at Cambridge on a scholarship, at the insistence of a professor called G. H. Hardy. Ramanujan’s time in England was most fruitful, expressing his talents in continued fractions and hypergeometric series.

His health was another matter, and Ramanujan sadly fell ill with tuberculosis. One day, Hardy visited Ramanujan at the hospital as he regularly had before, stepping out of a black cab with the number 1729, “rather a dull one,” Hardy said as he met Ramanujan. The great mathematician begged to differ.

“No, Hardy, it’s a very interesting number! It’s the smallest number expressible as the sum of two cubes in two different ways.”

Ramanujan had a fantastic memory and intuition about numbers. In the case of 1729, the number can be written as 1 cubed + 12 cubed and 9 cubed + 10 cubed. There’s no smaller integer that can be written as the sum of two cubes. The incident launched the “Hardy-Ramanujan number,” or “taxi-cab number”, a mathematical oddity that had mathematicians fascinated to this day. Only six other taxi-cab numbers have been found that share the same properties (smallest numbers which are the sum of cubes in n different ways).

But 1729 wasn’t just some quirky mathematical tidbit with no practical value, apart from entertaining mathematicians and Futurama fans. Ken Ono, a number theorist at Emory University, was perusing the Ramanujan archive while visiting Cambridge. He found notes scribbled by Ramanujan a year after Hardy told him all about his dull taxi number.

“From the bottom of one of the boxes in the archive, I pulled out one of Ramanujan’s deathbed notes,” Ono recalls. “The page mentioned 1729 along with some notes about it. Andrew and I realized that he had found infinitely near misses for Fermat’s Last Theorem for exponent 3. We were shocked by that, and actually started laughing. That was the first tip-off that Ramanujan had discovered something much larger.”

Pierre de Fermat was one of the greatest number theorist ever, but also a huge troll. Fermat refused to publish his work, and all we know of his work today comes from items such as letters and notes collected by his son Samuel. Fermat used to communicate all sorts of formulas and theorems to his friends and collaborators, and he never showed the proof.

He went on to discover several new patterns in numbers, which took mathematicians centuries to prove after his death. Why couldn’t you publish, Fermat? One example of his many theorems is the Two Square Theorem, which shows that any prime number which, when divided by 4, leaves a remainder of 1 (i.e. can be written in the form 4*n* + 1), can always be re-written as the sum of two square numbers.

In time Fermat’s reputation as a mathematician who never wrong grew. Eventually, only of one his theorems remained unsolved, which stated: *x*^{n} + *y*^{n} = *z*^{n }has no non-zero integer solutions for *x*, *y* and *z* when *n* > 2. It was all scribbled down as a marginal note in his copy of Diophantus‘s *Arithmetica, *alongside a most frustrating note: “*I have discovered a truly remarkable proof which this margin is too small to contain.”*

Ramanujan used an elliptic curve – a cubic equation and two variables where the largest degree is 3 – to show that there are infinity many solutions that are near misses to solving the equation. It wasn’t a direct proof of Fermat’s last theorem, but it was pretty close – all inspired by 1729. In doing so, Ramanujan found something remarkable: a K3 surface – objects used in string theory and quantum physics. The thing is, K3 surfaces were first described, let alone named, in the 1950s or decades after Ramanujan’s untimely death in 1920.

“This is the ultimate example of how Ramanujan anticipated theories,” Ono says. “When looking through his notes, you may see what appears to be just a simple formula. But if you look closer, you can often uncover much deeper implications that reveal Ramanujan’s true powers.”

“Ramanujan was using 1729 and elliptic curves to develop formulas for a K3 surface,” Ono says. “Mathematicians today still struggle to manipulate and calculate with K3 surfaces. So it comes as a major surprise that Ramanujan had this intuition all along.”

“We were able to tie the record for finding certain elliptic curves with an unexpected number of points, or solutions, without doing any heavy lifting at all,” Ono says. “Ramanujan’s formula, which he wrote on his deathbed in 1919, is that ingenious. It’s as though he left a magic key for the mathematicians of the future. All we had to do was recognize the key’s power and use it to drive solutions in a modern context.”

“This paper adds yet another truly beautiful story to the list of spectacular recent discoveries involving Ramanujan’s notebooks,” says Manjul Bhargava, a number theorist at Princeton University. “Elliptic curves and K3 surfaces form an important next frontier in mathematics, and Ramanujan gave remarkable examples illustrating some of their features that we didn’t know before. He identified a very special K3 surface, which we can use to understand a certain special family of elliptic curves. These new examples and insights are certain to spawn further work that will take mathematics forward.”

Ramanujan’s story will be turned into a film, soon to be released under the title: “The Man Who Knew Infinity.” Ono is one of the associate producers. Oh, and if you were curious, Fermat’s Last Theorem was solved in 1995 by Andrew Wiles.