#Bash+coreutils+BSDGames package, 79 70 bytes
Bash+coreutils+BSDGames package, 79 70 bytes
seq $[9**16]|while read n
do number $n|grep -q e||echo $n
done|sed $1q
Unfortunately this spawns number $n|grep -q e
for every number, so is rather slow.
###Output:
Output:
$ ./eban.sh 5
2
4
6
30
32
$
###Previous answer - outputs words instead of digits, 43 bytes
Previous answer - outputs words instead of digits, 43 bytes
seq $[9**16]|number -l|grep -v [e.]|sed $1q
This outputs each term written in words:
$ ./eban.sh 5
two
four
six
thirty
thirty-two
$
A bit faster, because each process is only spawned once.
#Much faster, no dependence on cheaty number
, 77 bytes
Much faster, no dependence on cheaty number
, 77 bytes
t=0{0,3,4,5,6}{0,2,4,6}
eval echo $t$t$t$t$t|tr \ '
'|sed "s/^0*//;$[$1+1]q"
This one uses bash brace expansion to generate all (according to my thinking) eban numbers up to 10^15. Looking at each group of 3 digits, the units digit must be one of {zero,two,four,six}, the tens digit must be one of {zero,thirty,forty,fifty,sixty}, and the hundreds digit must be zero. Since x-illion contains no e's up to quadrillion, then we can just combine the groups of three digits up to one quadrillion. The only exception is zero which must be skipped.
So we simply build a brace expansion to generate all these numbers. There are thus 205-1 of them (3.2 million). Evaluating the full bash brace expansion takes less than 5 seconds on my VM.
The sed
expression just strips off leading zeros and counts to n.
###Output:
Output:
$ time ./eban.bash 5
2
4
6
30
32
real 0m4.065s
user 0m3.724s
sys 0m0.276s
$ ./eban.bash 10000000 | wc -w
3199999
$ ./eban.bash 3199999 | tail -5
66066066066056
66066066066060
66066066066062
66066066066064
66066066066066
$