Taxicab numbers: Difference between revisions

m
Line 2,258:
Uses a dictionary to map sum of cubes to either the first/only pair or an integer index into the result set.
Turned out to be a fair bit slower (15s) than I first expected.
<lang Phix>function get_taxis(integer last)
function get_taxis(integer last)
sequence taxis = {}
integer c1 = 1, maxc1 = 0, c2
Line 2,298 ⟶ 2,297:
printf(1,"%d: %d: %s\n",{i,taxis[i][1],sprint(taxis[i][2])})
end for
end for</lang>
</lang>
{{out}}
<pre>
7,794

edits