
A   taxicab number   (the definition that is being used here)   is a positive integer that can be expressed as the sum of two positive cubes in more than one way.



The first taxicab number is   1729,   which is:

 13   +   123       and also
 93   +   103.


Taxicab numbers are also known as:

   taxi numbers
   taxi-cab numbers
   taxi cab numbers
   Hardy-Ramanujan numbers


Task

 Compute and display the lowest 25 taxicab numbers (in numeric order, and in a human-readable format).
 For each of the taxicab numbers, show the number as well as it's constituent cubes.


Extra credit
 Show the 2,000th taxicab number, and a half dozen more


See also

 A001235: taxicab numbers on The On-Line Encyclopedia of Integer Sequences.
 Hardy-Ramanujan Number on MathWorld.
 taxicab number on MathWorld.
 taxicab number on Wikipedia   (includes the story on how taxi-cab numbers came to be called).


-- demo\rosetta\Taxicab_numbers.exw
with javascript_semantics
function cube_sums()
    // create cubes and sorted list of cube sums
    sequence cubes = {}, sums = {}
    for i=1 to 1189 do
        atom cube = i * i * i
        sums &= sq_add(cubes,cube)
        cubes &= cube
    end for
    sums = sort(sums) -- (706,266 in total)
    return {cubes,sums}
end function

sequence {cubes, sums} = cube_sums()

atom nm1 = sums[1],
       n = sums[2]
integer idx = 1
printf(1,"First 25 Taxicab Numbers, 2000..2006th, and all interim triples:\n")
for i=3 to length(sums) do
    atom np1 = sums[i]
    if n=np1 and n!=nm1 then
        if idx<=25 
        or (idx>=2000 and idx<=2006)
        or n=sums[i+1] then
            sequence s = {}
            for j=1 to length(cubes) do
                atom x = cubes[j],
                     y = n-x
                if y<x then exit end if
                integer ydx = binary_search(y,cubes)
                if ydx>0 then
                    s = append(s,sprintf("(%3d^3=%9d) + (%4d^3=%10d)",{j,x,ydx,y}))
                end if
            end for
            printf(1,"%4d %10d = %s\n",{idx,n,join(s," or ")})
        end if
        idx += 1
    end if
    nm1 = n
    n = np1
end for
