login
a(n) = A348150(n) - A002275(n) where A002275(n) = R_n is the repunit with n times digit 1.
4

%I #22 Oct 15 2021 12:44:31

%S 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,

%T 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,

%U 52,15,23,40,21,20,10,21,11,25,33,41,47,45,14,1,171

%N a(n) = A348150(n) - A002275(n) where A002275(n) = R_n is the repunit with n times digit 1.

%C a(n) measures the gap between the smallest n-digit number not containing the digit 0 and the smallest n-digit Niven number not containing the digit 0.

%C For more informations and links, see A348150.

%C a(n) = 0 iff n is in A014950.

%H Michael S. Branicky, <a href="/A348317/b348317.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A348150(n) - A002275(n).

%e 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.

%t 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 *)

%o (Python)

%o def a(n):

%o s, k = "1"*n, int("1"*n)

%o while '0' in s or k%sum(map(int, s)): k += 1; s = str(k)

%o return k - int("1"*n)

%o print([a(n) for n in range(1, 73)]) # _Michael S. Branicky_, Oct 12 2021

%o (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

%Y Cf. A002275, A005349, A014950, A217973, A348150.

%K nonn,base

%O 1,4

%A _Bernard Schott_, Oct 12 2021

%E a(23) and beyond from _Michael S. Branicky_, Oct 12 2021