Problem 2369. Tribute to Ramanujan
The solution must be a lookup table since the 6th taxicab number is already greater than 2^64. If anyone find an algorithm for this, DO NOT publish here, publish a scientific paper. Researchers published a paper just about the upper bounds for the 7th to12th number for instance.
The 6th taxicab number is not even a certainty apparently http://jucs.org/jucs_9_10/what_is_the_value/Calude_C_S.pdf
Still, there's a lot that can be done to show that this might be a general solution within MATLAB numeric bounds.
Test cases! E.g. 9 and 4104 would catch when someone isn't checking that they have the SMALLEST number for a given number of ways. (e.g. 9==2^3+1^3, and 4104 == 16^3 + 2^3 == 15^3 + 9^3 are the SECOND smallest numbers for 1 and 2 ways. Random cases could be defined for this one).
Outlaw shortcut functions like str2num. Outlaw the string "1729" and other ways to calculate it and other known taxicab numbers as other than the sum of two cubes two ways. [e.g. it turns out that 1729==prod(1:6:19)].
not a general solution
Considering that the proof of the 6th taxicab number produced over 8GB of data and consisted of an exhaustive search over the integers up to 1e21, a truly generic solution is not really possible.
Problem Recent Solvers29
Project Euler: Problem 2, Sum of even Fibonacci
Relative ratio of "1" in binary number
More from this Author44
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!