A348317 a(n) = A348150(n) - A002275(n) where A002275(n) = R_n is the repunit with n times digit 1.
0, 1, 0, 5, 1, 3, 1, 1, 0, 14, 1, 15, 5, 3, 3, 11, 1, 21, 8, 10, 6, 5, 1, 3, 2, 12, 0, 17, 25, 14, 5, 13, 6, 74, 1, 54, 41, 12, 8, 14, 4, 105, 41, 55, 63, 33, 25, 13, 5, 103, 3, 33, 40, 63, 3, 52, 15, 23, 40, 21, 20, 10, 21, 11, 25, 33, 41, 47, 45, 14, 1, 171
Offset: 1
Examples
A348150(4) = 1116 since it is the smallest 4-digit integer not containing the digit 0 that is divisible by the sum of its digits:1116 = (1+1+1+6) * 124; A002275(4) = R_4 = 1111, hence a(4) = 1116 - 1111 = 5.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
hQ[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{m= (10^n - 1)/9,k=0}, While[! hQ[m+k], k++]; k]; Array[a, 30] (* Amiram Eldar, Oct 13 2021 *)
-
PARI
a(n) = my(r=(10^n-1)/9); for(k=r, 10^n-1, if (vecmin(digits(k)) && !(k % sumdigits(k)), return (k-r))); \\ Michel Marcus, Oct 13 2021
-
Python
def a(n): s, k = "1"*n, int("1"*n) while '0' in s or k%sum(map(int, s)): k += 1; s = str(k) return k - int("1"*n) print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Oct 12 2021
Extensions
a(23) and beyond from Michael S. Branicky, Oct 12 2021
Comments