login
A341889
a(n) is the smallest positive integer k > 1 such that n + k divides n^n + k, or 0 if no such k exists.
5
2, 0, 3, 2, 3, 4, 2, 6, 3, 5, 4, 10, 2, 12, 5, 2, 3, 16, 2, 18, 3, 4, 10, 22, 3, 24, 9, 8, 6, 28, 2, 30, 7, 17, 5, 6, 2, 36, 9, 5, 3, 40, 6, 42, 3, 4, 22, 46, 2, 20, 4, 16, 7, 52, 2, 14, 3, 5, 28, 58, 2, 60, 9, 8, 3, 9, 2, 66, 11, 20, 4, 70, 3, 72, 20, 14, 3, 8, 5, 78, 4, 32, 40, 82, 2, 24, 29, 11, 3, 88, 2, 6, 7, 23
OFFSET
1,1
COMMENTS
k > 1 is needed in the definition as n+1 divides n^n+1 for all odd n. - Chai Wah Wu, Jun 04 2021
LINKS
MATHEMATICA
a[n_] := Module[{k = 2}, While[! Divisible[n^n + k, n + k], k++]; k]; Array[a, 100, 3] (* Amiram Eldar, Jun 04 2021 *)
PROG
(PARI) a(n) = if(n==2, 0, my(k=2); while((n^n+k)%(n+k)!=0, k++); k);
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Jun 04 2021
STATUS
approved