A015908 Smallest odd k>n such that k | n^k + n, or 0 if n=2^m.
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
Keywords
Links
- Sean A. Irvine, Table of n, a(n) for n = 0..136
Crossrefs
Cf. A015906 (without restriction on the parity of k).
Programs
-
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 *)
-
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
Extensions
Missing a(0)=1, a(1)=0 inserted and a(5) corrected by Sean A. Irvine, Dec 19 2018