Smallest numbers: Difference between revisions
m
→{{header|Wren}}: Changed to Wren S/H
(Added Quackery.) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 804:
=={{header|Quackery}}==
<syntaxhighlight lang="Quackery">
[ stack ] is candidates ( --> s )
[ stack ] is results ( --> s )
Line 837 ⟶ 838:
sortwith
[ 1 peek swap 1 peek < ]
51 task echo</syntaxhighlight>
{{out}}
<pre>[ 9 1 3 5 2 4 4 3 7 9 10 11 5 19 22 26 8 17 16 19 9 8 13 7 17 4 17 3 11 18 13 5 23 17 18 7 17 15 9 18 16 17 9 7 12 28 6 23 9 24 23 ]</pre>
=={{header|Raku}}==
Line 956 ⟶ 957:
23
done...
</pre>
=={{header|RPL}}==
{{works with|HP|49}}
« { }
0 50 '''FOR''' n
1
'''WHILE''' DUP DUP ^ →STR n →STR POS NOT
'''REPEAT''' 1 + '''END'''
+
'''NEXT'''
» '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: {9 1 3 5 2 4 4 3 7 9 10 11 5 19 22 26 8 17 16 19 9 8 13 7 17 4 17 3 11 18 13 5 23 17 18 7 17 15 9 18 16 17 9 7 12 28 6 23 9 24 23}
</pre>
=={{header|Ruby}}==
Using a hash as memo:
<syntaxhighlight lang="ruby">memo = Hash.new{|h, k| h[k] = (k**k).to_s }
res = (0..50).map{|n| (1..).detect{|m| memo[m].include? n.to_s} }
res.each_slice(10){|slice| puts "%4d"*slice.size % slice }
</syntaxhighlight>
{{out}}
<pre> 9 1 3 5 2 4 4 3 7 9
10 11 5 19 22 26 8 17 16 19
9 8 13 7 17 4 17 3 11 18
13 5 23 17 18 7 17 15 9 18
16 17 9 7 12 28 6 23 9 24
23
</pre>
Line 967 ⟶ 998:
=={{header|Wren}}==
{{libheader|Wren-big}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
import "./
var res = []
Line 986 ⟶ 1,015:
}
System.print("The smallest positive integers K where K ^ K contains N (0..50) are:")
{{out}}
|