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


/* FIND SOME HUMBLE NUMBERS - NUMBERS WITH NO PRIME FACTORS ABOVE 7 */
humble_100H: procedure options                                                  (main);
 
/* PROGRAM-SPECIFIC %REPLACE STATEMENTS MUST APPEAR BEFORE THE %INCLUDE AS */
/* E.G. THE CP/M PL/I COMPILER DOESN'T LIKE THEM TO FOLLOW PROCEDURES      */
   /* PL/I                                                                      */
      %replace dclhumble by         400;
   /* PL/M */                                                                   /*
      DECLARE  DCLHUMBLE LITERALLY '401';
   /* */
 
/* PL/I DEFINITIONS                                                             */
%include 'pg.inc';
/* PL/M DEFINITIONS: CP/M BDOS SYSTEM CALL AND CONSOLE I/O ROUTINES, ETC. */    /*
   DECLARE BINARY LITERALLY 'ADDRESS', CHARACTER LITERALLY 'BYTE';
   DECLARE FIXED  LITERALLY ' ',       BIT       LITERALLY 'BYTE';
   DECLARE STATIC LITERALLY ' ',       RETURNS   LITERALLY ' ';
   DECLARE FALSE  LITERALLY '0',       TRUE      LITERALLY '1';
   DECLARE HBOUND LITERALLY 'LAST',    SADDR     LITERALLY '.';
   BDOSF: PROCEDURE( FN, ARG )BYTE;
                               DECLARE FN BYTE, ARG ADDRESS; GOTO 5;   END; 
   BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5;   END;
   PRCHAR:   PROCEDURE( C );   DECLARE C BYTE;      CALL BDOS( 2, C ); END;
   PRSTRING: PROCEDURE( S );   DECLARE S ADDRESS;   CALL BDOS( 9, S ); END;
   PRNL:     PROCEDURE;        CALL PRCHAR( 0DH ); CALL PRCHAR( 0AH ); END;
   PRNUMBER: PROCEDURE( N );
      DECLARE N ADDRESS;
      DECLARE V ADDRESS, N$STR( 6 ) BYTE, W BYTE;
      N$STR( W := LAST( N$STR ) ) = '$';
      N$STR( W := W - 1 ) = '0' + ( ( V := N ) MOD 10 );
      DO WHILE( ( V := V / 10 ) > 0 );
         N$STR( W := W - 1 ) = '0' + ( V MOD 10 );
      END; 
      CALL BDOS( 9, .N$STR( W ) );
   END PRNUMBER;
   MODF: PROCEDURE( A, B )ADDRESS;
      DECLARE ( A, B )ADDRESS;
      RETURN( A MOD B );
   END MODF;
   MIN: PROCEDURE( A, B ) ADDRESS; 
      DECLARE  ( A, B ) ADDRESS;
      IF A < B THEN RETURN( A ); ELSE RETURN( B );
   END MIN;
/* END LANGUAGE DEFINITIONS */
 
   /* TASK */
 
   /* DISPLAY A STASTIC ABOUT HUMBLE NUMBERS */
   PRHUMBLESTAT: PROCEDURE( S, D );
      DECLARE ( S, D ) FIXED BINARY;
      CALL PRSTRING( SADDR( 'THERE ARE $' ) );
      IF S <  10 THEN CALL PRCHAR( ' ' );
      IF S < 100 THEN CALL PRCHAR( ' ' );
      CALL PRNUMBER( S );
      CALL PRSTRING( SADDR( ' HUMBLE NUMBERS WITH $' ) );
      CALL PRNUMBER( D );
      CALL PRSTRING( SADDR( ' DIGIT$' ) );
      IF D > 1 THEN CALL PRCHAR( 'S' );
      CALL PRNL;
   END PRHUMBLESTAT;
 
   /* FIND AND PRINT HUMBLE NUMBERS */
 
   DECLARE H( DCLHUMBLE ) FIXED BINARY;
   DECLARE ( P2, P3, P5, P7, M
           , LAST2, LAST3, LAST5, LAST7
           , H1, H2, H3, H4, HPOS
           , MAXHUMBLE
           ) FIXED BINARY;
 
   MAXHUMBLE = HBOUND( H                                                        ,1
                     );
 
   /* 1 IS THE FIRST HUMBLE NUMBER */
   H( 1 ) = 1;
   LAST2 = 1; LAST3 = 1; LAST5 = 1; LAST7 = 1;
   P2    = 2; P3    = 3; P5    = 5; P7    = 7;
   DO HPOS = 2 TO MAXHUMBLE;
      /* THE NEXT HUMBLE NUMBER IS THE LOWEST OF THE NEXT MULTIPLES OF */
      /* 2, 3, 5, 7  */
      M = MIN( MIN( MIN( P2, P3 ), P5 ), P7 );
      H( HPOS ) = M;
      IF M = P2 THEN DO; LAST2 = LAST2 + 1; P2 = 2 * H( LAST2 ); END;
      IF M = P3 THEN DO; LAST3 = LAST3 + 1; P3 = 3 * H( LAST3 ); END;
      IF M = P5 THEN DO; LAST5 = LAST5 + 1; P5 = 5 * H( LAST5 ); END;
      IF M = P7 THEN DO; LAST7 = LAST7 + 1; P7 = 7 * H( LAST7 ); END;
   END;
 
   /* SHOW THE FIRST 50 HUMBLE NUMBERS */
   DO HPOS = 1 TO 50;
      CALL PRCHAR( ' ' );
      M = H( HPOS );
      IF M <  10 THEN CALL PRCHAR( ' ' );
      IF M < 100 THEN CALL PRCHAR( ' ' );
      CALL PRNUMBER( H( HPOS ) );
      IF MODF( HPOS, 16 ) = 0 THEN CALL PRNL;
   END;
   CALL PRNL;
 
   /* SHOW THE NUMBER OF HUMBLE NUMBERS UP TO VARIOUS POWERS OF 10 */
   H1 = 0; H2 = 0; H3 = 0; H4 = 0;
   DO HPOS = 1 TO MAXHUMBLE;
      M = H( HPOS );
      IF      M <    10 THEN H1 = H1 + 1;
      ELSE IF M <   100 THEN H2 = H2 + 1;
      ELSE IF M <  1000 THEN H3 = H3 + 1;
      ELSE IF M < 10000 THEN H4 = H4 + 1;
   END;
 
   CALL PRHUMBLESTAT( H1, 1 );
   CALL PRHUMBLESTAT( H2, 2 );
   CALL PRHUMBLESTAT( H3, 3 );
   CALL PRHUMBLESTAT( H4, 4 );
 
EOF: end humble_100H;