# Taxicab Numbers

I got a little distracted halfway through my number theory homework so I decided to write a post. At least the topic is pertinent to number theory, right?

I first came across taxicab numbers a few years ago while jumping between Wikipedia math articles. Last summer, I was watching the play “Proof” (which was amazing by the way, if you’re ever in New York while its playing then I recommend you watch it) with a friend of mine and the main character mentioned that “1729” is a special number. As soon as I heard that, I felt a memory trying to make its way out from the back of my brain. After a few seconds I finally remembered where I’d seen it and I started excitedly whispering to my friend, frantically trying to explain why the number was special (she still makes fun of how worked-up I got).

For those that are unfamiliar, 1729 is known as the Hardy-Ramanujan number after this anecdote:

“I remember once going to see him when he was ill at Putney. I had ridden in taxi cab number 1729 and remarked that the number seemed to me rather a dull one, and that I hoped it was not an unfavorable 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.” - G.H. Hardy Source

How does this related to taxicab numbers? In mathematics, the nth taxicab number is the smallest number that can be written as the sum of two positive cube numbers in “n” unique ways.

Unfortunately I must get back to this problem set, so I just quickly threw together a program in R to test whether a number can be expressed as the sum of two positive cube numbers in 2 different ways. The script doesn’t test whether such a number is the smallest so it is not a true taxicab check in that regard. Perhaps I’ll update this later to be a true taxicab check or even write a program to generate taxicab numbers (this seems like a difficult and fun problem).

Some examples (the function runs very fast):