The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A317358 a(n) is the smallest number k > 1 such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k). 5
 2, 3, 5, 2, 2, 7, 11, 2, 2, 3, 3, 2, 2, 17, 17, 2, 2, 3, 3, 2, 2, 23, 29, 2, 2, 5, 3, 2, 2, 31, 37, 2, 2, 37, 35, 2, 2, 3, 41, 2, 2, 43, 47, 2, 2, 3, 3, 2, 2, 5, 5, 2, 2, 3, 3, 2, 2, 59, 61, 2, 2, 67, 3, 2, 2, 55, 71, 2, 2, 35, 35, 2, 2, 3, 5, 2, 2, 5, 5, 2, 2 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 COMMENTS a(n) = 2 if and only if n == {0, 1} (mod 4). a(n) <= A151800(n). A133906(n) <= a(n) <= A133907(n). The sequence is unbounded. Numbers n such that a(n-1) = n are 2, 3, 7, 23, 31, 43, 59, 139, 283, ... By the Agoh-Giuga conjecture, if a(n-1) = n, then n is a prime. It seems that if a(n) > n, then a(n) is a prime (the next prime after n). If a(n) = n, then n is in A121707. These numbers are 35, 143, 187, 215, ... Conjecture: all composite terms of the sequence are A121707. LINKS Chai Wah Wu, Table of n, a(n) for n = 1..10000 (n = 1..1000 from Seiichi Manyama) Wikipedia, Agoh-Giuga conjecture MATHEMATICA a[n_] := Block[{k=2}, While[Mod[Sum[PowerMod[j, k-1, k], {j, n}], k] != Mod[n, k], k++]; k]; Array[a, 81] (* Giovanni Resta, Jul 29 2018 *) PROG (PARI) a(n) = for(k=2, oo, if (sum(j=1, n, Mod(j, k)^(k-1)) == n, return (k)); ); \\ Michel Marcus, Jul 26 2018 (Python) 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 A317358(n):     k = 2     while g(n, k-1, k):         k += 1     return k # Chai Wah Wu, Jul 30 2018 CROSSREFS Cf. A133906, A133907, A151800, A121707, A317058, A317357. Sequence in context: A255913 A065996 A133906 * A133907 A232931 A060084 Adjacent sequences:  A317355 A317356 A317357 * A317359 A317360 A317361 KEYWORD nonn AUTHOR Thomas Ordowski, Jul 26 2018 EXTENSIONS More terms from Michel Marcus, Jul 26 2018 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 16 18:53 EDT 2021. Contains 343050 sequences. (Running on oeis4.)