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


use strict;
use warnings;
use List::Util 'min';
 
#use bigint     # works, but slow
use Math::GMPz; # this module gives roughly 16x speed-up
 
sub humble_gen {
    my @s = ([1], [1], [1], [1]);
    my @m = (2, 3, 5, 7);
    @m = map { Math::GMPz->new($_) } @m; # comment out to NOT use Math::GMPz
 
    return sub {
    my $n = min $s[0][0], $s[1][0], $s[2][0], $s[3][0];
    for (0..3) {
            shift @{$s[$_]} if $s[$_][0] == $n;
            push @{$s[$_]}, $n * $m[$_]
        }
        return $n
    }
}
 
my $h = humble_gen;
my $i = 0;
my $upto = 50;
 
my $list;
++$i, $list .= $h->(). " " until $i == $upto;
print "$list\n";
 
$h = humble_gen; # from the top...
my $count  = 0;
my $digits = 1;
 
while ($digits <= $upto) {
    ++$count and next if $digits == length $h->();
    printf "Digits: %2d - Count: %s\n", $digits++, $count;
    $count = 1;
}