Distinct power numbers: Difference between revisions

m
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 863:
</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}}==
<syntaxhighlight lang="ruby">a = (2..5).to_a
Line 884 ⟶ 896:
{{libheader|Wren-seq}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./seq" for Lst
import "./fmt" for Fmt
 
var pows = []
Line 897 ⟶ 909:
pows = Lst.distinct(pows).sort()
System.print("Ordered distinct values of a ^ b for a in [2..5] and b in [2..5]:")
for (chunk in Lst.chunks(pows, 5)) Fmt.printtprint("$,5d", chunkpows, 5)
System.print("\nFound %(pows.count) such numbers.")</syntaxhighlight>
 
9,476

edits