OFFSET
1,1
COMMENTS
If n = 1, all the solutions of x | 1 + Sum_{k=1..x-1} k^(x-1) should be prime numbers, according to Giuga's conjecture.
If n*x | 1 + Sum_{k=1..x-1} k^(x-1), then certainly x does, so Giuga's conjecture would say x must be prime. Similarly if x^n divides it, so does x, so again Giuga would say x is prime. - Robert Israel, Apr 26 2019
E.g., the first solution for x^2 | 1 + Sum_{k=1..x-1} k^(x-1) is x = 1277, that is prime.
LINKS
Robert Israel, Table of n, a(n) for n = 1..2000
Eric Weisstein's World of Mathematics, Giuga's Conjecture
FORMULA
Least solution of n*x | 1 + Sum_{k=1..x-1} k^(x-1), for n = 1, 2, 3, ...
EXAMPLE
a(4) = 7 because (1 + 1^6 + 2^6 + 3^6 + 4^6 + 5^6 + 6^6) / (4*7) = 67172 / 28 = 2399 and it is the least prime to have this property.
MAPLE
P:=proc(j) local k, n; for n from 2 to 10^6 do
if frac((add(k^(n-1), k=1..n-1)+1)/(j*n))=0
then RETURN(n); break; fi; od; end: seq(P(i), i=1..60);
MATHEMATICA
a[n_] := For[x = 2, True, x++, If[Divisible[1+Sum[k^(x-1), {k, x-1}], n x], Return[x]]];
Array[a, 60] (* Jean-François Alcover, Oct 16 2020 *)
PROG
(PARI) a(n) = my(x=2); while (((1 + sum(k=1, x-1, k^(x-1))) % (n*x)), x++); x; \\ Michel Marcus, Apr 27 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paolo P. Lava, Apr 05 2019
STATUS
approved