A356978 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.
13, 11, 1145, 121, 31109, 1510081, 34110497, 5343853441, 17636269729
Offset: 1
Examples
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.
Programs
-
Maple
sd:= n -> convert(convert(n,base,10),`+`): f:= proc(n) local d; for d from 1 do if n^d mod sd(n^d) <> 1 then return d-1 fi od end proc: V:= Vector(6): count:= 0: for n from 1 while count < 6 do v:= f(n); if v > 0 and V[v] = 0 then count:= count+1; V[v]:= n fi od: convert(V,list);
-
Mathematica
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 *)
Extensions
a(7) from Amiram Eldar, Sep 07 2022
a(8) and a(9) from Giorgos Kalogeropoulos, Sep 09 2022.
Comments