A342650 Numbers divisible both by their nonzero individual digits and by the sum of their digits.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 20, 24, 30, 36, 40, 48, 50, 60, 70, 80, 90, 100, 102, 110, 111, 112, 120, 126, 132, 135, 140, 144, 150, 162, 200, 204, 210, 216, 220, 222, 224, 240, 264, 280, 288, 300, 306, 312, 315, 324, 330, 333, 336, 360, 396, 400, 408, 420, 432, 440, 444, 448, 480, 500
Offset: 1
Examples
102 is divisible by its nonzero digits 1 and 2, and 102 is also divisible by the sum of its digits 1 + 0 + 2 = 3, then 102 is a term.
Programs
-
Mathematica
q[n_] := AllTrue[(d = IntegerDigits[n]), # == 0 || Divisible[n, #] &] && Divisible[n, Plus @@ d]; Select[Range[500], q] (* Amiram Eldar, Mar 18 2021 *)
-
PARI
isok(m) = if (!(m % sumdigits(m)), my(d=select(x->(x>0), Set(digits(m)))); setintersect(d, divisors(m)) == d); \\ Michel Marcus, Mar 18 2021
Comments