login
A015908
Smallest odd k>n such that k | n^k + n, or 0 if n=2^m.
2
1, 0, 0, 15, 0, 1565, 111, 35, 0, 123, 365, 671, 15, 185653, 259, 85, 0, 4369, 39, 247, 800005, 39, 55, 115, 1731, 85, 221, 135, 35, 105821, 51, 403, 0, 55, 1649, 1939, 3177, 3293, 95, 2283, 3845, 697, 357, 215, 143, 153, 667, 235, 435, 511, 485
OFFSET
0,4
LINKS
MATHEMATICA
fk[n_]:=Module[{k=n+1}, If[EvenQ[k], k++]; If[IntegerQ[Log[2, n]], k=0, While[ Mod[ n^k+n, k]!=0, k+=2]]; k]; Array[fk, 60, 0] (* Harvey P. Dale, Mar 12 2019 *)
PROG
(PARI) isp2(n) = (n==1) || (n==2) || (isprimepower(n, &p) && (p==2));
a(n) = {if (isp2(n), return (0)); my(k = if (n%2, n+2, n+1)); while(lift(Mod(n, k)^k + Mod(n, k)), k+=2); k; } \\ Michel Marcus, Dec 19 2018
CROSSREFS
Cf. A015906 (without restriction on the parity of k).
Sequence in context: A225312 A370335 A333845 * A361355 A366146 A040228
KEYWORD
nonn
EXTENSIONS
Missing a(0)=1, a(1)=0 inserted and a(5) corrected by Sean A. Irvine, Dec 19 2018
STATUS
approved