Digital root/Multiplicative digital root: Difference between revisions

Added Quackery.
(Updated to work with Nim 1.4. Removed "newSeqWith" template which is available in standard module "sequtils".)
(Added Quackery.)
Line 2,314:
{{out}}
(Exactly the same as before).
 
=={{header|Quackery}}==
 
<lang Quackery> [ abs 1 swap
[ base share /mod
rot * swap
dup 0 = until ]
drop ] is digitproduct ( n --> n )
[ 0 swap
[ dup base share > while
dip 1+
digitproduct again ] ] is mdr ( n --> n n )
[ dup mdr
rot echo
say ": "
swap echo
say ", "
echo cr ] is task.1 ( n --> )
[ times
[ i^ [] swap dup rot
[ unrot dup mdr nip
swap dip
[ over = ]
swap iff
[ rot over join ]
else rot
dip 1+
dup size 5 = until ]
i^ echo say " : "
echo cr 2drop ] ] is task.2 ( n --> )
' [ 123321 7739 893 899998 ] witheach task.1
cr
10 task.2</lang>
 
{{out}}
 
<pre>123321: 3, 8
7739: 3, 8
893: 3, 2
899998: 2, 0
 
0 : [ 0 20 30 40 45 ]
1 : [ 1 11 111 1111 11111 ]
2 : [ 2 12 21 26 34 ]
3 : [ 3 13 31 113 131 ]
4 : [ 4 14 22 27 39 ]
5 : [ 5 15 35 51 53 ]
6 : [ 6 16 23 28 32 ]
7 : [ 7 17 71 117 171 ]
8 : [ 8 18 24 29 36 ]
9 : [ 9 19 33 91 119 ]
</pre>
 
=={{header|Racket}}==
1,462

edits