Jump to content

Taxicab numbers: Difference between revisions

Line 1,878:
2006: 1677646971 = 990^3 + 891^3 = 1188^3 + 99^3
</pre>
 
=={{header|Mathematica}}==
<lang Mathematica>findTaxiNumbers[n_] := Block[{data = <||>},
Do[AppendTo[data, x^3 + y^3 -> Lookup[data, x^3 + y^3, 0] + 1],
{x, 1, n},
{y, x, n}];
Sort[Keys[Select[data, # >= 2 &]]]
];
Take[findTaxiNumbers[100], 25]
findTaxiNumbers[1200][[2000 ;; 2005]]</lang>
{{out}}
{1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597}
 
{1671816384, 1672470592, 1673170856, 1675045225, 1675958167, 1676926719}
 
 
=={{header|PARI/GP}}==
Line 1,936 ⟶ 1,951:
402597 = 61^3 + 56^3
402597 = 69^3 + 42^3</pre>
 
=={{header|Pascal}}==
{{works with |Free Pascal}}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.