OFFSET
1,3
LINKS
Sebastian Karlsson, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = n*A010848(n)/2, if n is odd.
a(n) = n*(n-1)/2, if n is both odd and squarefree.
a(p^e) = (1/2)*(p-1)*p^(2*e-1), if p is an odd prime.
a(2^e) = 2^(e-1).
MAPLE
a:= n-> add(k&^n mod n, k=1..n-1):
seq(a(n), n=1..55); # Alois P. Heinz, Feb 13 2021
PROG
(Python)
def a(n):
return sum([pow(k, n, n) for k in range(1, n)])
for n in range(1, 56):
print(a(n), end=', ')
(PARI) a(n) = sum(k=1, n-1, lift(Mod(k, n)^n)); \\ Michel Marcus, Jan 22 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Sebastian Karlsson, Jan 22 2021
STATUS
approved