Find the first n taxicab numbers. Given a value n. I would like to find the first n taxicab numbers.
A taxicab being a number that can be expressed as the sum of two perfect cubes in more than one way.
(Note that there are two related but different sets referred to as
‘taxicab numbers’: the sums of 2 cubes in more than 1
way, and the smallest numbers that are the
sum of 2 positive integral cubes inn
ways. This question is about the former set,
since the latter set has only the first six members known)
For example:
1^3 + 12^3 = 1729 = 9^3 + 10^3
I would like a rough overview of the algorithm or the C snippet of how to approach the problem.
The first five of these are:
I J K L Number
---------------------------------
1 12 9 10 1729
2 16 9 15 4104
2 24 18 20 13832
10 27 19 24 20683
4 32 18 30 32832
I figured out the answer could be obtained this way:
Since
a^3+b^3 = n,ashould be less thann^(1/3).