SeedRandom[1]
While[Length[pr] < 2,
pr = Select[FreeQ @ 0] @ PowersRepresentations[RandomInteger[{2, 10^6}], 3, 3]]; //
AbsoluteTiming // First
5.8*10^-6
{{a, b, c}, {d, k, f}, n} = Join[pr[[;;2]], {Total[pr[[1]]^3]}]
{{2, 3, 16}, {3, 9, 15}, 4131}
Total[pr^3, {2}]
{4131, 4131}
If you want the 6 numbers all distinct:
SeedRandom[1]
While[Length[Union @@ pr] < 6,
pr = Select[FreeQ@0]@
PowersRepresentations[RandomInteger[{2, 10^6}], 3, 3]]; //
AbsoluteTiming // First
0.0000275
pr
{{5, 53, 88}, {12, 29, 93}, {15, 74, 75}}
Total[pr[[1]]^3]
830474