My latest book ‘The Simpsons and Their Mathematical Secrets’ explains that two episodes of ‘The Simpsons’ contain references to Fermat’s Last Theorem. In fact, the episodes contain so-called ** near misses**, which are sets of numbers that almost fit Fermat’s notorious equation, but not quite.

The book also discusses ‘Futurama’, and explains how 1,729 appears in several episodes, because the mathematician Ramanujan commented that it is the smallest natural number that is the sum of two cubes in two different ways.

1,729 = 10^{3} + 9^{3}

1,729 = 12^{3} + 1^{3}

Of course, there is link between Fermat near misses and Ramanujan’s 1,729, and therefore a link between the mathematics of ‘The Simpsons’ and the mathematics of ‘Futurama’, because:

**Fermat’s Last Theorem looks for solutions to x ^{n} + y^{n} = z^{n}**

**where n>2.**

**The two ways to form 1,729 can be matched as 10 ^{3} + 9^{3 }= 12^{3} + 1^{3}**

In other words (10^{3} + 9^{3 }= 12^{3}) is a near miss solution to Fermat’s Last Theorem, as it only misses by 1 (or 1^{3}).

I am grateful to Mike Hirschhorn, a mathematician at the University of New South Wales, who pointed out that Ramanujan identified a way to generate an infinite number of near misses of the form:

x^{3} + y^{3 }= z^{3} ± 1

If you want to find out more, then you can read Mike’s papers on Ramanujan and Fermat near misses on his website (39, 40, 107 and 128).