Eban numbers: Difference between revisions

Content added Content deleted
m (→‎{{header|Perl 6}}: Better output formatting, trap some edge case errors.)
(→‎{{header|Perl 6}}: modify to accept multi-letter 'bans', note OEIS sequences covered)
Line 38: Line 38:
Modular approach, very little is hard coded. Change the order of magnitude limits to adjust the search/display ranges. Change the letter given to the nban sub to change which letter to disallow.
Modular approach, very little is hard coded. Change the order of magnitude limits to adjust the search/display ranges. Change the letter given to the nban sub to change which letter to disallow.


Demonstrate for e-ban and t-ban. n-ban and i-ban are interesting too.
Demonstrate for e-ban and t-ban. Will handle multi-character 'bans' as well.

Directly find :
:* [[oeis:A006933|OEIS Numbers without e]]: Eban
:* [[oeis:A089589|OEIS Numbers without i]]: Iban
:* [[oeis:A089590|OEIS Numbers without u]]: Uban
:* [[oeis:A008521|OEIS Numbers without o]]: Oban
:* [[oeis:A008523|OEIS Numbers without t]]: Tban
:* [[oeis:A072954|OEIS Numbers without a, i, l, t]]: TALIban


<lang perl6>use Lingua::EN::Numbers::Cardinal;
<lang perl6>use Lingua::EN::Numbers::Cardinal;


sub nban ($seq, $n = 'e') { ($seq).map: { next if .&cardinal.contains($n); $_ } }
sub nban ($seq, $n = 'e') { ($seq).map: { next if .&cardinal.contains(any($n.comb)); $_ } }


sub comma { $^i.flip.comb(3).join(',').flip }
sub comma { $^i.flip.comb(3).join(',').flip }