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


on isGapful(n)
    set units to n mod 10
    set temp to n div 10
    repeat until (temp < 10)
        set temp to temp div 10
    end repeat
 
    return (n mod (temp * 10 + units) = 0)
end isGapful
 
-- Task code:
on getGapfuls(n, q)
    set collector to {}
    repeat until ((count collector) = q)
        if (isGapful(n)) then set end of collector to n
        set n to n + 1
    end repeat
    return collector
end getGapfuls
 
local output, astid
set output to {}
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "  "
set end of output to "First 30 gapful numbers ≥ 100:" & linefeed & getGapfuls(100, 30)
set end of output to "First 15 gapful numbers ≥ 1,000,000:" & linefeed & getGapfuls(1000000, 15)
set end of output to "First 10 gapful numbers ≥ 100,000,000:" & linefeed & getGapfuls(1.0E+9, 10)
set AppleScript's text item delimiters to linefeed & linefeed
set output to output as text
set AppleScript's text item delimiters to astid
return output