Smallest numbers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(Added Quackery.) |
||
Line 801: | Line 801: | ||
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 |
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> |
</pre> |
||
=={{header|Quackery}}== |
|||
<syntaxhighlight lang="Quackery"> [ stack ] is candidates ( --> s ) |
|||
[ stack ] is results ( --> s ) |
|||
[ [] swap times |
|||
[ i^ number$ |
|||
nested join ] |
|||
candidates put |
|||
[] results put |
|||
0 |
|||
[ 1+ dup |
|||
dup ** number$ |
|||
candidates share |
|||
reverse witheach |
|||
[ over 2dup findseq |
|||
swap found iff |
|||
[ dip over |
|||
$->n drop |
|||
join nested |
|||
results take |
|||
join |
|||
results put |
|||
candidates take |
|||
i pluck drop |
|||
candidates put ] |
|||
else drop ] |
|||
drop |
|||
candidates share |
|||
[] = until ] |
|||
drop |
|||
candidates release |
|||
results take |
|||
sortwith |
|||
[ 1 peek swap 1 peek < ] |
|||
witheach |
|||
[ 0 peek echo sp ] ] is task ( n --> ) |
|||
51 task</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}}== |
=={{header|Raku}}== |
||
<syntaxhighlight lang="raku" line>sub smallest ( $n ) { |
<syntaxhighlight lang="raku" line>sub smallest ( $n ) { |