login
a(n) is the first number k such that k^i is a quasi-Niven number (A209871) for 1<=i<=n but not for i=n+1.
0

%I #11 Sep 26 2022 20:26:45

%S 13,11,1145,121,31109,1510081,34110497,5343853441,17636269729

%N a(n) is the first number k such that k^i is a quasi-Niven number (A209871) for 1<=i<=n but not for i=n+1.

%C a(n) is the first number k such that the remainder on division of k^i by its sum of digits is 1 for 1<=i<=n but not i=n+1.

%e a(4) = 121 because 121, 121^2 = 14641, 121^3 = 1771561, 121^4 = 214358881, and 121^5 = 25937424601 have sums of digits 4, 16, 28, 40, and 43 respectively, and 121 mod 4 = 1, 121^2 mod 16 = 1, 121^3 mod 28 = 1, 121^4 mod 40 = 1, but 121^4 mod 43 = 41 <> 1, and 121 is the first number that works.

%p sd:= n -> convert(convert(n,base,10),`+`):

%p f:= proc(n) local d;

%p for d from 1 do

%p if n^d mod sd(n^d) <> 1 then return d-1 fi

%p od

%p end proc:

%p V:= Vector(6): count:= 0:

%p for n from 1 while count < 6 do

%p v:= f(n);

%p if v > 0 and V[v] = 0 then

%p count:= count+1; V[v]:= n

%p fi

%p od:

%p convert(V,list);

%t quasiNivenQ[n_] := (s = Plus @@ IntegerDigits[n]) > 1 && Divisible[n - 1, s]; f[k_] := Module[{i = 0, m = k}, While[quasiNivenQ[m], m *= k; i++]; i]; seq[len_, nmax_] := Module[{s = Table[0, {len}], n = 2, c = 0, i}, While[c < len && n < nmax, i = f[n]; If[0 < i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[6, 10^7] (* _Amiram Eldar_, Sep 07 2022 *)

%Y Cf. A007953, A209871.

%K nonn,base,more

%O 1,1

%A _Robert Israel_, Sep 07 2022

%E a(7) from _Amiram Eldar_, Sep 07 2022

%E a(8) and a(9) from _Giorgos Kalogeropoulos_, Sep 09 2022.