Hardy, Ramanujan and Taxi No. 1729

In his book Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, G. H. Hardy tells this famous story:

He could remember the idiosyncracies of numbers in an almost uncanny way. It was Littlewood who said every positive integer was one of Ramanujan’s personal friends. I remember once going to see him when he was lying ill at Putney. I had ridden in taxi-cab No. 1729, and remarked that the number seemed to be rather a dull one, and that I hoped it was not an unfavourable omen. “No,” he replied, “it is a very interesting number; it is the smallest number expressible as the sum of two cubes in two different ways.”

Namely,

10^3 + 9^3 = 1000 + 729 = 1729 = 1728 + 1 = 12^3 + 1^3

But there’s more to this story than meets the eye.

First, it’s funny how this story becomes more dramatic with each retelling. In the foreword to Hardy’s book A Mathematician’s Apology, his friend C. P. Snow tells it thus:

Hardy used to visit him, as he lay dying in hospital at Putney. It was on one of those visits that there happened the incident of the taxicab number. Hardy had gone out to Putney by taxi, as usual his chosen method of conveyance. He went into the room where Ramanujan was lying. Hardy, always inept about introducing a conversation, said, probably without a greeting, and certainly as his first remark: “I thought the number of my taxicab was 1729. It seemed to me rather a dull number.” To which Ramanujan replied: “No, Hardy! No, Hardy! It is a very interesting number. It is the smallest number expressible as the sum of two cubes in two different ways.”

Here Hardy becomes “inept” and makes his comment “probably without a greeting, and certainly as his first remark”. Perhaps the ribbing of a friend who knew Hardy’s ways?

I think I’ve seen later versions where Hardy “burst into the room”.

But it’s common for legends to be embroidered with the passage of time. Here’s something more interesting. In Ono and Trebat-Leder’s paper The 1729 K3 surface, they write:

While this anecdote might give one the impression that Ramanujan came up with this amazing property of 1729 on the spot, he actually had written it down before even coming to England.

In fact they point out that Ramanujan wrote it down more than once!

Before he went to England, Ramanujan mainly published by posting puzzles to the questions section of the Journal of the Indian Mathematical Society. In 1913, in Question 441, he challenged the reader to prove a formula expressing a specific sort of perfect cube as a sum of three perfect cubes. If you keep simplifying this formula to see why it works, you eventually get

12^3 = (-1)^3 + 10^3 + 9^3

In Ramanujan’s Notebooks, Part III, Bruce Berndt explains that Ramanujan developed a method for finding solutions of Euler’s diophantine equation

a^3 + b^3 = c^3 + d^3

in his “second notebook”. This is one of three notebooks Ramanujan left behind after his death—and the results in this one were written down before he first went to England. In Item 20(iii) he describes his method and lists many example solutions, the simplest being

1^3 + 12^3 = 9^3 + 10^3

In 1915 Ramanujan posed another puzzle about writing a sixth power as a sum of three cubes, Question 661. And he posed a puzzle about writing $1$ as a sum of three cubes, Question 681.

Finally, four or five years later, Ramanujan revisited the equation a^3 + b^3 = c^3  + d^3 in his so-called Lost Notebook. This was actually a pile of 138 loose unnumbered pages written by Ramanujan in the last two years of his life, 1919 and 1920. George Andrews found them in a box in Trinity College, Cambridge much later, in 1976.

Now the pages have been numbered, published and intensively studied: George Andrews and Bruce Berndt have written five books about them! Here is page 341 of Ramanujan’s Lost Notebook, where he came up with a method for finding an infinite family of integer solutions to the equation a^3 + b^3 = c^3  + d^3:



As you can see, one example is

9^3 + 10^3 = 12^3 + 1

In Section 8.5 of George Andrews and Bruce Berndt’s book
Ramanujan’s Lost Notebook: Part IV, they discuss Ramanujan’s method, calling it “truly remarkable”.

In short, Ramanujan was well aware of the special properties of the number 1729 before Hardy mentioned it. And something prompted Ramanujan to study the equation a^3 + b^3 = c^3  + d^3 again near the end of his life, and find a new way to solve it.

Could it have been the taxicab incident??? Or did Hardy talk about the taxi after Ramanujan had just thought about the number 1729 yet again? In the latter case, it’s hardly a surprise that Ramanujan remembered it.

Thinking about this story, I’ve started wondering about what really happened here. First of all, as James Dolan pointed out to me, you don’t need to be a genius to notice that

1000 + 729 = 1728 + 1

Was Hardy, the great number theorist, so blind to the properties of numbers that he didn’t notice either of these ways of writing 1729 as a sum of two cubes? Base ten makes them very easy to spot if you know your cubes, and I’m sure Hardy knew 9^3 = 729 and 12^3 = 1728.

Second of all, how often do number theorists come out and say that a number is uninteresting? Except in that joke about the “least uninteresting number”, I don’t think I’ve heard it happen.

My wife Lisa suggested an interesting possibility that would resolve all these puzzles:

Hardy either knew of Ramanujan’s work on this problem or noticed himself that 1729 had a special property. He wanted to cheer up his dear friend Ramanujan, who was lying deathly ill in the hospital. So he played the fool by walking in and saying that 1729 was “rather dull”.

I have no real evidence for this, and I’m not claiming it’s true. But I like how it flips the meaning of the story. And it’s not impossible. Hardy was, after all, a bit of a prankster: each time he sailed across the Atlantic he sent out a postcard saying he had proved the Riemann Hypothesis, just in case he drowned.

We could try to see if there really was a London taxi with number 1729 at that time. It would be delicious to discover that it was merely an invention of Hardy’s. But I don’t know if records of London taxi-cab numbers from around 1919 still exist.

Maybe I’ll let C. P. Snow have the last word. After telling his version of the incident with Hardy, Ramanujan and the taxicab, he writes:

This is the exchange as Hardy recorded it. It must be substantially accurate. He was the most honest of men; and further no one could possibly have invented it.

35 Responses to Hardy, Ramanujan and Taxi No. 1729

  1. ken abbott says:

    A great insight into the Ramanujan technique of finding a general solution, but then pumping out endless special cases.

  2. Todd Trimble says:

    To me, the fact that Ramanujan said on the spot that 1729 was the least solution undermines the notion that this is the first time he ever thought of it.

    I like Lisa’s suggestion. Erdos did something similar when Stan Ulam was in the hospital after a brain operation, not to the point where Erdos was playing a fool, but giving Ulam puzzles as a way to assure him that his brain was still plenty strong.

    There was a 2015 movie about Ramanujan, The Man Who Knew Infinity, with Dev Patel of Slumdog Millionaire as Ramanujan and Jeremy Irons as Hardy. They duly enacted a version of that scene, but it landed with a dull muted thud. I doubt anyone not knowing the story already even realized what happened!

    • John Baez says:

      I saw that movie, which I generally liked—in part because I like Jeremy Irons, I like Hardy and Ramanujan, and I like any movie that makes a halfway reasonable attempt at talking about mathematicians or scientists. But I don’t remember that scene at all! I was trying to remember it just now, to see how much the story had been exaggerated. Maybe not enough?

      • Yes, I recall that you don’t like unrealistic portrayals of mathematicians in movies. From my memory (actually my file of quotations, but I remember that it is there), you once wrote:

        AIN’T IT JUST THAT WAY: In Barbra Streisand’s new movie, “the object of her desire is Jeff Bridges, a handsome, distracted math professor, whose own life has been so undone by sex and beautiful women that he longs for a platonic union….” [LA Times, Thursday Nov. 7]

        —included in a sci.physics.research post by John Baez

        Remember, old statisticians never die; they just get broken down by age and sex. :-)

    • Todd Trimble says:

      Here’s the clip:

      It happens so quickly and so undramatically that I’m not surprised you missed it. :-)

      (I also liked the movie, overall.)

  3. Jesús López says:

    There is a Wikipedia entry on the Taxicab number.

  4. AK says:

    The same opinion is expressed by Richard Borcherds here

    Introduction to number theory lecture 1

  5. Blake Stacey says:

    In one of Feynman’s anecdote books, he told a story about getting into a duel with an abacus salesman. The last and most dramatic problem they race to solve is taking the cube root of 1729.03, which Feynman realizes he can do in his head because he happens to remember that there are 1728 cubic inches in a cubic foot, and the 1.03 can be handled with Taylor series. If I recall correctly, I read the Feynman story before I read the Hardy–Ramanujan story, so the first time I encountered the latter, I was half-unsurprised. I have no great talent for number theory, then or now, and so when I consider how much better at it Hardy would have been, I find it pretty plausible that Hardy knew all about 1729. I like the “he played the fool” explanation for that reason, and because I find it charming.

    • gwern says:

      Speaking of Feynman, I’m reminded how he would astonish people by solving problems on the spot – he had, of course, independently worked out the problems before, and could just present his results. Ramanujan may have done similar feats likewise.

      This merely means that their feat is impressive in a different way, of course. Like the stage magician who tricks us because we can’t imagine anyone going to such trouble, we can’t imagine being so interested in physics or number theory as to work out and recall all these problems and, say, go through every integer <10,000 and learn every property one can.

  6. Arabinda Roy says:

    1729 = sum of cubes of 1,3,3,7,11

  7. J says:

    It is also the third Carmichael number.

  8. Vj Laxmanan says:

    The sum of cubes of 6 and 8, mentioned just below 1729, is actually the smaller number…1729 is NOT the “smallest” … am sure Ramanujan realized it too :)

    Laxmanan

    • John Baez says:

      But that one involves negative integers, and if we really go ahead and allow negative integers everywhere there’s no smallest integer that’s the sum of two cubes of integers in two different ways.

  9. John Baez says:

    Reading C. P. Snow’s foreward to Hardy’s A Mathematician’s Apology, I see that after he tells his version of story of Hardy, Ramanujan and the taxicab, he writes:

    This is the exchange as Hardy recorded it. It must be substantially accurate. He was the most honest of men; and further no one could possibly have invented it.

    The last part is an echo of what Hardy said about some of the formulas in Ramanujan’s first letter to him:

    They must be true because, if they were not true, no one would have the imagination to invent them.

  10. उन्मुक्त says:

    There are two very good books about Ramanujan that are worth worth reading:

    1- The Man Who Knew Infinity : A Life of the Genius Ramanujan by Robert Kanigel. There is also movie of the same name referred to in some of the comments.

    2- The Indian Clerk by David Leavitt.

    The first one is accurate and the second one has taken some liberty with facts (narrated in the end) to make the book interesting.

    Both are worth anyone’s time and money.

    Here you can read more about the person at QUEST FOR A MILLION DOLLARS: Srinivasa Ramanujan – The Genius .

  11. RSN says:

    Ramanujan for ever will remain a puzzle for future generations.

  12. allenknutson says:

    I forget where I heard the version

    “What was your taxicab number?”
    “Oh, something uninteresting…. 14.”
    “What do you mean ‘uninteresting’? It’s the smallest number that’s the product of 2 and 7 in two different ways.”

  13. I vote for Lisa’s explanation. Hardy was all over this stuff like a cheap suit and it is unthinkable he would not have known or be surprised by such a low level observation. It was his way of having a bit of cheery mathematical badinage with Ramanujan in his last days. Far more perplexing is what went on between Bohr and Heisenberg in Copenhagen and why.

    • John Baez says:

      It’s interesting to hear you like Lisa’s theory.

      I hope everyone here has seen, or can someday see, a performance of the play Copenhagen. It’s quite good.

      • Blake Stacey says:

        When I was an undergrad, I worked at MIT’s Cyclotron Lab, i.e., the building where the electromagnet from the original cyclotron had been left because it was too heavy to move, and then repurposed for other tasks that needed a strong magnetic field. The play Copenhagen came to Boston, and their publicity people thought it would be neat to have the cast visit a lab that had equipment from the era of the play. I don’t know if they knew ahead of time that the lab director knew Heisenberg, but they enjoyed the story, which he definitely liked to tell:

        In early 1975, Becker went to Germany for a talk about their result [the observation of the J/psi meson]. He recalled to Technology Review that theoretical physicist Werner Heisenberg interrupted his talk to comment, “Whenever they don’t know what it is, they invent a new quark.” To which Becker replied, “’Look, Professor Heisenberg, I’m not arguing whether this is charm or not charm. I’m telling you it’s a particle which doesn’t go away.’ Dead silence. It got very cold in the room. Then Heisenberg said, ‘Accepted.’”

        We got free tickets to see the play, and after their last night performing in Boston, we joined the actors for a late dinner in Chinatown.

  14. One of the things about Heisenberg that I can’t quite fathom is that he was not really across matrices! It took Max Born and Pascual Jordan to stiffen up his treatment of the commutativity concept.At least this is what some of the commentaries suggest. There is a reference to a meeting with Einstein to discuss matrices in one source. I can’t judge whether these perspectives are true or not. Maybe there is a deathbed scene with Heisenberg and someone playfully says “Werner, you remember back in the 20s there were those things and they didn’t…what’s the word? – commute? What’s the story with that?”

    • John Baez says:

      Peter Haggstrom wrote:

      One of the things about Heisenberg that I can’t quite fathom is that he [had] not really [come] across matrices!

      Apparently at that time physicists did not routinely learn about matrices, so Heisenberg reinvented them! Then his thesis advisor, Max Born, said something like “hey, you’ve reinvented matrices—go read about them”.

  15. James Smith says:

    I have often wondered about this. It is true that you hardly have to be a genius to see that you can write 1729 as the sum of the cubes of 1 and 12 and also of 9 and 10 (even I spotted it). The genius bit is knowing that it cannot be done in any other way.

    I have always thought that there would be some clever proof along that lines that 1 and 12 are as far apart as possible whilst 9 and 10 are as close together as possible. This suggests to me that there are some related curves or such like that could be drawn to prove this (I am being really vague here but this is the point, I have never managed to figure it out).

    It would be great to see an actual proof distilled from Ramanujan’s work. My suspicion has always been that he had worked through such a proof before the taxi incident, at least informally and perhaps with other numbers.

    You write:

    …This is one of three notebooks Ramanujan left behind after his death…and the results in this one were written down before he first went to England. In Item…he describes his method (for finding finding solutions of Euler’s diophantine equation a^3 + b^3 = c^3 + d^3) and lists many example solutions, the simplest being 1^3 + 12^3 = 9^3 + 10^3.

    So it would be really good to see this proof.

  16. pd says:

    Copying my comment from Hacker News:

    “I remember once going to see him when he was lying ill at Putney. I had ridden in taxi-cab No. 1729, and remarked that the number seemed to be rather a dull one, and that I hoped it was not an unfavourable omen. “No,” he replied, “it is a very interesting number; it is the smallest number expressible as the sum of two cubes in two different ways.”

    The quote above is from G. H. Hardy himself, from the book “Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work”. There was no need for him to embellish the story while it was published to “cheer up” Ramanujan, since the book was published in 1940 after Ramanujan’s death.

    Two great men can have different interests in the same field. It does not mean one of them had less ability. Hardy, since his early days, was fascinated by pure mathematics and rigor. Ramanujan was playing with numbers on pieces of paper since he was a child. That’s why their contributions and intuitions, even though in the same broad field, are so different.

You can use Markdown or HTML in your comments. You can also use LaTeX, like this: $latex E = m c^2 $. The word 'latex' comes right after the first dollar sign, with a space after it.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.