Numbers   (positive integers expressed in base ten)   that are (evenly) divisible by the number formed by the
first and last digit are known as   gapful numbers.


Evenly divisible   means divisible with   no   remainder.



All   one─   and two─digit   numbers have this property and are trivially excluded.   Only
numbers    ≥  100   will be considered for this Rosetta Code task.



Example

187   is a   gapful   number because it is evenly divisible by the
number   17   which is formed by the first and last decimal digits
of    187. 



About   7.46%   of positive integers are   gapful.



Task

   Generate and show all sets of numbers (below) on one line (horizontally) with a title,   here on this page
   Show the first   30   gapful numbers
   Show the first   15   gapful numbers    ≥           1,000,000
   Show the first   10   gapful numbers    ≥    1,000,000,000


Related tasks

   Harshad or Niven series.
   palindromic gapful numbers.
   largest number divisible by its digits.


Also see

   The OEIS entry:   A108343 gapful numbers.
   numbersaplenty gapful numbers


100H: /* FIND SOME GAPFUL NUMBERS: NUMBERS DIVISIBLE BY 10F + L WHERE F IS */
      /*                           THE FIRST DIGIT AND L IS THE LAST DIGIT */
   BDOS: PROCEDURE( FN, ARG ); /* CP/M BDOS SYSTEM CALL */
      DECLARE FN BYTE, ARG ADDRESS;
      GOTO 5;
   END BDOS;
   PR$CHAR:   PROCEDURE( C ); DECLARE C BYTE;    CALL BDOS( 2, C ); END;
   PR$STRING: PROCEDURE( S ); DECLARE S ADDRESS; CALL BDOS( 9, S ); END;
   PR$NL:     PROCEDURE; CALL PR$CHAR( 0DH ); CALL PR$CHAR( 0AH );  END;
   PR$NUMBER: PROCEDURE( N );
      DECLARE N ADDRESS;
      DECLARE V ADDRESS, N$STR( 6 ) BYTE, W BYTE;
      V = N;
      W = LAST( N$STR );
      N$STR( W ) = '$';
      N$STR( W := W - 1 ) = '0' + ( V MOD 10 );
      DO WHILE( ( V := V / 10 ) > 0 );
         N$STR( W := W - 1 ) = '0' + ( V MOD 10 );
      END;
      CALL PR$STRING( .N$STR( W ) );
   END PR$NUMBER;
   /* RETURNS TRUE IF N IS GAPFUL, FALSE OTHERWISE                         */
   IS$GAPFUL: PROCEDURE( N )BYTE;
      DECLARE N ADDRESS;
      DECLARE F ADDRESS;
      F = N / 10;
      DO WHILE ( F > 9 );
         F = F / 10;
      END;
      RETURN N MOD ( ( F * 10 ) + ( N MOD 10 ) ) = 0;
   END IS$GAPFUL;
   /* FIND THE FIRST 30 GAPFUL NUMBERS >= 100                              */
   CALL PR$STRING( .'FIRST 30 GAPFUL NUMBERS STARTING FROM 100:$' );
   CALL PR$NL; 
   DECLARE N ADDRESS, G$COUNT BYTE;
   G$COUNT = 0;
   N = 100;
   DO WHILE ( G$COUNT < 30 );
      IF IS$GAPFUL( N ) THEN DO;
         /* HAVE A GAPFUL NUMBER                                           */
         G$COUNT = G$COUNT + 1;
         CALL PR$CHAR( ' ' );
         CALL PR$NUMBER( N );
      END;
      N = N + 1;
   END;
   CALL PR$NL;
 
EOF