Humble numbers are positive integers which have   no   prime factors    >    7.



Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite,

although this conflicts with another meaning of   highly composite numbers.



Another way to express the above is:

  humble  =  2i × 3j × 5k × 7m 

           where     i, j, k, m ≥ 0 



Task

   show the first   50   humble numbers   (in a horizontal list)
   show the number of humble numbers that have   x   decimal digits for all   x's   up to   n   (inclusive).
   show   (as many as feasible or reasonable for above)   on separate lines
   show all output here on this page


Related tasks

   Hamming numbers


References

   Wikipedia: Smooth numbers, see the 2nd paragraph.
   OEIS A002473: humble numbers
   University of Ulm, The first 5842 terms of humble numbers


-- demo/rosetta/humble.exw
with javascript_semantics 
include mpfr.e
 
procedure humble(integer n, bool countdigits=false)
-- if countdigits is false: show first n humble numbers,
-- if countdigits is true: count them up to n digits.
    sequence humble = {mpz_init(1)},
             nexts = {2,3,5,7},
             indices = repeat(1,4)
    for i=1 to 4 do nexts[i] = mpz_init(nexts[i]) end for
    integer digits = 1,
            count = 1,
            dead = 1,
            tc = 0
    atom t0 = time()
    mpz p10 = mpz_init(10)
    while ((not countdigits) and length(humble)<n)
       or (countdigits and digits<=n) do
        mpz x = mpz_init_set(mpz_min(nexts))
        humble = append(humble,x)
        if countdigits then
            if mpz_cmp(x,p10)>=0 then
                mpz_mul_si(p10,p10,10)
                integer d = min(indices)
                for k=dead to d-1 do
                    humble[k] = mpz_free(humble[k])
                end for
                dead = d
                string s = iff(digits=1?"":"s"),
                       e = elapsed(time()-t0)
                tc += count
--              e &= sprintf(", %,d dead",{dead-1})
                e &= sprintf(", total:%,d",{tc})
                printf(1,"%,12d humble numbers have %d digit%s (%s)\n",{count,digits,s,e})
                digits += 1
                count = 1
            else
                count += 1
            end if
        end if
        for j=1 to 4 do
            if mpz_cmp(nexts[j],x)<=0 then
                indices[j] += 1
                mpz_mul_si(nexts[j],humble[indices[j]],get_prime(j))
            end if
        end for
    end while
    if not countdigits then
        for i=1 to length(humble) do
            humble[i] = shorten(mpz_get_str(humble[i]),ml:=10)
        end for
        printf(1,"First %d humble numbers: %s\n\n",{n,join(humble," ")})
    end if
end procedure
 
humble(50)
humble(42,true)
