Eban numbers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: I twiddle because I can...) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: update description to match) |
||
Line 129: | Line 129: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{works with|Rakudo|2018.12}} |
{{works with|Rakudo|2018.12}} |
||
Modular approach, very little is hard coded. Change the order |
Modular approach, very little is hard coded. Change the $upto order-of-magnitude limit to adjust the search/display ranges. Change the letter(s) given to the nban sub to modify which letter(s) to disallow. |
||
Demonstrate for e-ban |
Will handle multi-character 'bans'. Demonstrate for e-ban, t-ban and subur-ban. |
||
Directly find : |
Directly find : |
||
Line 177: | Line 177: | ||
"{$n}-ban numbers between 1,000 & 4,000: {+@j}\n{@j.gist}\n"; |
"{$n}-ban numbers between 1,000 & 4,000: {+@j}\n{@j.gist}\n"; |
||
for (1 .. |
for (1 .. $upto).map: { 10**$_ } -> $e { |
||
my $f = @bans.first( * > $e, :k ); |
my $f = @bans.first( * > $e, :k ); |
||
printf "Up to %14s: %d\n",comma($e), $f ?? +@bans[^$f] !! +@bans; |
printf "Up to %14s: %d\n",comma($e), $f ?? +@bans[^$f] !! +@bans; |