
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).


void main() /*@safe*/ {
    import std.stdio, std.range, std.algorithm, std.typecons, std.string;
 
    auto iCubes = iota(1u, 1201u).map!(x => tuple(x, x ^^ 3));
    bool[Tuple!(uint, uint)][uint] sum2cubes;
    foreach (i, immutable i3; iCubes)
        foreach (j, immutable j3; iCubes[i .. $])
            sum2cubes[i3 + j3][tuple(i, j)] = true;
 
    const taxis = sum2cubes.byKeyValue.filter!(p => p.value.length > 1)
                  .array.schwartzSort!(p => p.key).release;
 
    foreach (/*immutable*/ const r; [[0, 25], [2000 - 1, 2000 + 6]]) {
        foreach (immutable i, const t; taxis[r[0] .. r[1]])
            writefln("%4d: %10d =%-(%s =%)", i + r[0] + 1, t.key,
                     t.value.keys.sort().map!q{"%4d^3 + %4d^3".format(a[])});
        writeln;
    }
}