Eban numbers: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added wording in the REXX section header. |
Thundergnat (talk | contribs) →{{header|Perl 6}}: Add a Perl 6 example |
||
Line 33:
:* The OEIS entry: [[http://oeis.org/A006933 A6933, eban numbers]].
<br><br>
=={{header|Perl 6}}==
{{works with|Rakudo|2018.12}}
<lang perl6>use Lingua::EN::Numbers::Cardinal;
sub eban (@seq) { (@seq».Int).map: { next if .&cardinal.contains('e'); $_ } }
sub comma { $^i.flip.comb(3).join(',').flip }
my @eban = flat ((1 .. 100),).map: *.&eban;
my @orders = ( ( 1e3, 2e3 ... 9e3 ),
( 1e4, 2e4 ... 9e4 ),
( 1e6, 2e6 ... 9e6 ),
( 1e7, 2e7 ... 9e7 ),
( 1e9, 2e9 ... 9e9 ),
).map: *.&eban;
for @orders -> @order {
my @these;
for @order {
my @extend = flat $_, flat @eban X+ $_;
@these.append: @extend;
}
@eban.append: @these
}
my $k = @eban.first( * > 100, :k );
put @eban[^$k];
say "Up to 100: ", +@eban[^$k];
say '=' x 40;
my $b = @eban.first( * >= 1000, :k );
my $f = @eban.first( * >= 4000, :k );
put @eban[$b .. $f];
say "From 1,000 to 4,000: ", +@eban[$b .. $f];
say '=' x 40;
for (1e4, 1e5, 1e6, 1e7, 1e9)».Int
-> $e {
my $f = @eban.first( * >= $e, :k );
say "Up to {comma $e}: ", +@eban[^$f];
say '=' x 40;
}</lang>
{{out}}
<pre>2 4 6 30 32 34 36 40 42 44 46 50 52 54 56 60 62 64 66
Up to 100: 19
========================================
2000 2002 2004 2006 2030 2032 2034 2036 2040 2042 2044 2046 2050 2052 2054 2056 2060 2062 2064 2066 4000
From 1,000 to 4,000: 21
========================================
Up to 10,000: 79
========================================
Up to 100,000: 399
========================================
Up to 1,000,000: 399
========================================
Up to 10,000,000: 1599
========================================
Up to 1,000,000,000: 7999
========================================</pre>
=={{header|REXX}}==
|