Eban numbers: Difference between revisions
m
→{{header|Perl 6}}: Fix fence-post error. Auto-adjust string width.
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Reorder OEIS sequences into numeric order. More efficient counting. Consider numbers up to 10**21 as task directions suggest.) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Fix fence-post error. Auto-adjust string width.) |
||
Line 286:
@count.push: @count.sum * @orders[$_] + @orders[$_] for ^(+@orders - 1);
@count[0] += 1 if 0.&nban($n);
for ^(@count - 1) { if (10**(2+$_)).&nban($n) { @count[$_]++; @count[$_ + 1]-- } }
[\+] @count;
}
Line 306:
"\nCounts of {$n}-ban numbers up to {cardinal 10**$upto}"
;
my $s = max (^$upto).map: {(10**$_).&cardinal.chars };
@counts.unshift: @bans.first: * > 10, :k;
for @counts.kv -> $k, $c {
printf "Up to and including %
}
}</lang>
|