Digital root/Multiplicative digital root: Difference between revisions

Content added Content deleted
m (→‎{{header|Go}}: add some examples with high MP)
(Updated D entries)
Line 316: Line 316:
writefln("%6d: (%s, %s)", n, n.mdRoot[]);
writefln("%6d: (%s, %s)", n, n.mdRoot[]);


auto table = 10.iota.zip((int[]).init.repeat).assocArray;
auto table = (int[]).init.repeat.enumerate!int.take(10).assocArray;
auto n = 0;
auto n = 0;
while (table.byValue.map!walkLength.reduce!min < 5) {
while (table.byValue.map!walkLength.reduce!min < 5) {
Line 372: Line 372:
writefln("%6d: (%s, %s)", n, n.mdRoot[]);
writefln("%6d: (%s, %s)", n, n.mdRoot[]);


auto table = 10.iota.zip((int[]).init.repeat).assocArray;
auto table = (int[]).init.repeat.enumerate!int.take(10).assocArray;
auto n = 0;
auto n = 0;
while (table.byValue.map!walkLength.reduce!min < 5) {
while (table.byValue.map!walkLength.reduce!min < 5) {
Line 410: Line 410:
writefln("%6d: %s", n, n.mdRoot);
writefln("%6d: %s", n, n.mdRoot);


auto table = 10.iota.zip((uint[]).init.repeat).assocArray;
auto table = (int[]).init.repeat.enumerate!int.take(10).assocArray;
auto n = 0;
auto n = 0;
while (table.byValue.map!walkLength.reduce!min < 5) {
while (table.byValue.map!walkLength.reduce!min < 5) {