Distinct power numbers: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
|||
Line 644: | Line 644: | ||
Found 15 such numbers. |
Found 15 such numbers. |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
<lang XPL0>int A, B, N, Last, Next; |
|||
[Last:= 0; |
|||
loop [Next:= -1>>1; \infinity |
|||
for A:= 2 to 5 do \find smallest Next |
|||
for B:= 2 to 5 do \ that's > Last |
|||
[N:= fix(Pow(float(A), float(B))); |
|||
if N>Last & N<Next then Next:= N; |
|||
]; |
|||
if Next = -1>>1 then quit; |
|||
IntOut(0, Next); ChOut(0, ^ ); |
|||
Last:= Next; |
|||
]; |
|||
]</lang> |
|||
{{out}} |
|||
<pre> |
|||
4 8 9 16 25 27 32 64 81 125 243 256 625 1024 3125 |
|||
</pre> |
</pre> |