login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A317357
a(n) is the smallest composite k > n such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k).
5
4, 341, 473, 6, 10, 133, 497, 14, 12, 15, 15, 16, 18, 143, 35, 20, 32, 51, 57, 38, 28, 77, 253, 36, 30, 65, 39, 36, 58, 115, 155, 62, 36, 187, 119, 40, 74, 57, 247, 52, 80, 287, 2051, 86, 55, 69, 69, 94, 54, 175, 85, 65, 65, 159, 69, 70, 64, 551, 1711, 72
OFFSET
1,1
COMMENTS
According to the Agoh-Giuga conjecture, a(n) > n+1.
a(n) > A151800(n) for all n < 33.
a(n) <= A271221(n) for n > 1.
MATHEMATICA
a[n_] := Block[{k = n+1}, While[PrimeQ[k] || Mod[Sum[PowerMod[j, k-1, k], {j, n}], k] != n, k++]; k]; Array[a, 60] (* Giovanni Resta, Jul 26 2018 *)
PROG
(PARI) a(n) = forcomposite(k=n+1, , if (sum(j=1, n, Mod(j, k)^(k-1)) == n, return (k)); ); \\ Michel Marcus, Jul 26 2018
(Python)
from sympy import isprime
def g(n, p, q): # compute (-n + sum_{k=1, n} k^p) mod q
c = (-n) % q
for k in range(1, n+1):
c = (c+pow(k, p, q)) % q
return c
def A317357(n):
k = n+1
while isprime(k) or g(n, k-1, k):
k += 1
return k # Chai Wah Wu, Jul 31 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Jul 26 2018
EXTENSIONS
More terms from Giovanni Resta, Jul 26 2018
STATUS
approved