

Definition

An   eban   number is a number that has no letter    e    in it when the number is spelled in English.

Or more literally,   spelled numbers that contain the letter   e   are banned.



The American version of spelling numbers will be used here   (as opposed to the British).

2,000,000,000   is two billion,   not   two milliard.



Only numbers less than   one sextillion   (1021)   will be considered in/for this task.

This will allow optimizations to be used.



Task

   show all eban numbers   ≤   1,000   (in a horizontal format),   and a count
   show all eban numbers between   1,000   and   4,000   (inclusive),   and a count
   show a count of all eban numbers up and including           10,000
   show a count of all eban numbers up and including         100,000
   show a count of all eban numbers up and including      1,000,000
   show a count of all eban numbers up and including    10,000,000
   show all output here.


See also

   The MathWorld entry:   eban numbers.
   The OEIS entry:   A6933, eban numbers.


with javascript_semantics
function count_eban(integer p10)
-- returns the count of eban numbers 1..power(10,p10)
    integer n = p10-floor(p10/3),
            p5 = floor(n/2),
            p4 = floor((n+1)/2)
    return power(5,p5)*power(4,p4)-1
end function
 
function eban(integer n)
-- returns true if n is an eban number (only fully tested to 10e9)
    if n=0 then return false end if
    while n do
        integer thou = remainder(n,1000)
        if floor(thou/100)!=0 then return false end if
        if not find(floor(thou/10),{0,3,4,5,6}) then return false end if
        if not find(remainder(thou,10),{0,2,4,6}) then return false end if
        n = floor(n/1000)
    end while
    return true
end function
 
sequence s = {}
for i=0 to 1000 do
    if eban(i) then s = append(s,sprint(i)) end if
end for
printf(1,"eban to 1000 : %s\n\n",{join(shorten(s,"items",8))})
s = {}
for i=1000 to 4000 do
    if eban(i) then s = append(s,sprint(i)) end if
end for
printf(1,"eban 1000..4000 : %s\n\n",{join(shorten(s,"items",4))})
 
atom t0 = time()
for i=0 to 21 do
    printf(1,"count_eban(10^%d) : %,d\n",{i,count_eban(i)})
end for
?elapsed(time()-t0)
