Distinct power numbers: Difference between revisions
Content added Content deleted
No edit summary |
(add RPL) |
||
Line 863: | Line 863: | ||
</pre> |
</pre> |
||
=={{header|RPL}}== |
|||
≪ { } |
|||
2 5 '''FOR''' a |
|||
2 5 '''FOR''' b |
|||
a b ^ |
|||
'''IF''' DUP2 POS '''THEN''' DROP '''ELSE''' + '''END''' |
|||
'''NEXT NEXT''' SORT |
|||
≫ '<span style="color:blue">DPOWR</span>' STO |
|||
{{out}} |
|||
<pre> |
|||
1: { 4 8 9 16 25 27 32 64 81 125 243 256 625 1024 3125 } |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
<syntaxhighlight lang="ruby">a = (2..5).to_a |
<syntaxhighlight lang="ruby">a = (2..5).to_a |