A256786 Numbers which are divisible by prime(d) for all digits d in their decimal representation.
12, 14, 42, 55, 154, 222, 228, 714, 1122, 1196, 1212, 1414, 2112, 2142, 2262, 3355, 4144, 4242, 5335, 5544, 5555, 6162, 9499, 11112, 11144, 11214, 11424, 11466, 11622, 11818, 11914, 12222, 12882, 14112, 15554, 16666, 21216, 21222, 21252, 21888, 22122, 22212
Offset: 1
Examples
Smallest terms containing the nonzero decimal digits: . d | prime(d) | n | a(n) . ---+----------+-------------------------- . 1 | 2 | 1 | 12 = 2^2 * 3 . 2 | 3 | 1 | 12 = 2^2 * 3 . 3 | 5 | 16 | 3355 = 5 * 11 * 61 . 4 | 7 | 2 | 14 = 2 * 7 . 5 | 11 | 4 | 55 = 5 * 11 . 6 | 13 | 10 | 1196 = 2^2 * 13 * 23 . 7 | 17 | 8 | 714 = 2 * 3 * 7 * 17 . 8 | 19 | 7 | 228 = 2^2 * 3 * 19 . 9 | 23 | 10 | 1196 = 2^2 * 13 * 23 .
Links
- Lars Blomberg and Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Éric Angelini, Divisibility by primes, SeqFan list, Apr 10 2015.
- Index entries for 10-automatic sequences.
Crossrefs
Programs
-
Haskell
a256786 n = a256786_list !! (n-1) a256786_list = filter f a052382_list where f x = g x where g z = z == 0 || x `mod` a000040 d == 0 && g z' where (z', d) = divMod z 10
-
Mathematica
Select[Range@22222,FreeQ[IntegerDigits[#],0]&&Total[Mod[#,Prime[IntegerDigits[#]]]]==0&] (* Ivan N. Ianakiev, Apr 11 2015 *)
-
PARI
is_A256786(n)=!for(i=1,#d=Set(digits(n)),(!d[i]||n%prime(d[i]))&&return) \\ M. F. Hasler, Apr 11 2015
-
Python
primes = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23] def ok(n): s = str(n) return "0" not in s and all(n%primes[int(d)] == 0 for d in s) print([k for k in range(22213) if ok(k)]) # Michael S. Branicky, Dec 14 2021
Comments