Next highest int from digits: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(Added Quackery.) |
||
Line 1,968: | Line 1,968: | ||
45072010 -> 5 of 1861: [45072100, 45100027, 45100072, 45100207, 45100270] |
45072010 -> 5 of 1861: [45072100, 45100027, 45100072, 45100207, 45100270] |
||
95322020 -> 1 of 1: [95322200]</pre> |
95322020 -> 1 of 1: [95322200]</pre> |
||
=={{header|Quackery}}== |
|||
<code>nextperm</code> is defined at [[Permutations with some identical elements#Quackery]]. |
|||
<syntaxhighlight lang="Quackery"> [ [] swap |
|||
[ 10 /mod |
|||
rot join swap |
|||
dup 0 = until ] |
|||
drop ] is ->digits ( n --> [ ) |
|||
[ 0 swap |
|||
witheach |
|||
[ swap 10 * + ] ] is digits-> ( [ --> n ) |
|||
[ dup ->digits |
|||
nextperm |
|||
digits-> |
|||
tuck < not if |
|||
[ drop 0 ] ] is task ( n- -> n ) |
|||
' [ 0 9 12 21 12453 738440 45072010 |
|||
95322020 9589776899767587796600 ] |
|||
witheach [ task echo sp ]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>0 0 21 0 12534 740348 45072100 95322200 9589776899767587900667</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |