# Ramanujan's Taxi Cab Numbers

There is a well known anecdote concerning the self-taught Indian mathematical genius Srinivasa Ramanujan. The British mathemetician G.H. Hardy went to visit him in hospital one day, and remarked that he had travelled in taxi cab number 1729, which seemed rather a dull number. 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"

It's certainly true that 1729 = 13 + 123 = 93 + 103. Such numbers have become known as 'taxi cab' numbers.

Can you write an APL function which returns all the taxi cab numbers with terms up to N3 (where N is an integer > 0), and also displays the pairs of cubes ?

While you're at it, you might want to use APL to verify some other interesting facts about the number 1729. For example:

(a) In base 10 the number 1729 is evenly divisible by the sum of its digits. The same is true in base 8 and base 16, but not base 2.

(b) When the digits of 1729 are added together they produce a sum which, when multiplied by its reversal, yields the original number:

• 1 + 7 + 2 + 9 = 19      ;    19 × 91 = 1729

Can you find any other numbers which have this property?

Author: SimonMarsden

TaxiCabNumbers/Task (last edited 2009-02-08 21:51:39 by SimonMarsden)