Permuted multiples: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(Added Quackery.)
Line 953: Line 953:
</pre>
</pre>
I believe that last pattern will be continue to be valid no matter how many 9s are inserted in the middle, and I doubt that any further patterns would emerge.
I believe that last pattern will be continue to be valid no matter how many 9s are inserted in the middle, and I doubt that any further patterns would emerge.

=={{header|Quackery}}==

<syntaxhighlight lang="Quackery"> [ [] swap
[ 10 /mod
rot join swap
dup 0 = until ]
drop ] is digits ( n --> [ )

[ true swap
dup digits sort
swap
5 times
[ dup i 2 + *
digits sort
dip over != if
[ rot not unrot
conclude ] ]
2drop ] is permult ( n --> b )

0
[ 1+
dup permult until ]
6 times
[ dup
i^ 1+ dup echo
say " * n = "
* echo cr ]
drop</syntaxhighlight>

{{out}}

<pre>1 * n = 142857
2 * n = 285714
3 * n = 428571
4 * n = 571428
5 * n = 714285
6 * n = 857142</pre>


=={{header|Raku}}==
=={{header|Raku}}==