OFFSET
1,3
COMMENTS
a(n) = n-1 if and only if n is prime or is a Giuga number A007850.
a(n) = 1 if (and probably only if) n is a primary pseudoperfect number A054377.
a(2^k*p) = 2^(k-1)*p-2^k if p is an odd prime. - Robert Israel, Apr 25 2017
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Jonathan Sondow and K. MacMillan, Reducing the Erdos-Moser equation 1^n + 2^n + . . . + k^n = (k+1)^n modulo k and k^2, Integers 11 (2011), #A34.
Jonathan Sondow and E. Tsukerman, The p-adic order of power sums, the Erdos-Moser equation, and Bernoulli numbers, arXiv:1401.0322 [math.NT], 2014; see section 4.
Wikipedia, Giuga number
Wikipedia, Primary pseudoperfect number
FORMULA
a(n) = A235137(n) (mod n).
Conjecture : a(n) = Sum_{d|n} phi(n/d)*d^phi(n) (mod n). - Ridouane Oudra, Feb 17 2024
EXAMPLE
a(4) = 30 (mod 4) = 2 since 1^(phi(4)) + 2^(phi(4)) + 3^(phi(4)) + 4^(phi(4))= 1^2 + 2^2 + 3^2 + 4^2 = 1 + 4 + 9 + 16 = 30.
MAPLE
f:= proc(n) local q; q:= numtheory:-phi(n);
add(k&^q, k=1..n) mod n
end proc:
map(f, [$1..100]); # Robert Israel, Apr 25 2017
MATHEMATICA
a[n_] := Mod[Sum[PowerMod[i, EulerPhi@n, n], {i, n}], n]
PROG
(PARI) a(n)=my(p=eulerphi(n)); sum(k=1, n, k^p) \\ Charles R Greathouse IV, Jan 04 2014
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Jonathan Sondow and Emmanuel Tsukerman, Jan 03 2014
STATUS
approved