A196777 Sum (mod n) of the distinct residues of x^n (mod n), x=0..n-1.
0, 1, 0, 1, 0, 2, 0, 1, 0, 5, 0, 2, 0, 0, 0, 1, 0, 2, 0, 2, 0, 0, 0, 2, 0, 13, 0, 0, 0, 0, 0, 1, 0, 17, 0, 2, 0, 0, 0, 2, 0, 4, 0, 22, 0, 0, 0, 2, 0, 25, 0, 0, 0, 2, 0, 28, 0, 29, 0, 4, 0, 0, 0, 1, 0, 0, 0, 17, 0, 0, 0, 2, 0, 37, 0, 38, 0, 0, 0, 2, 0, 41, 0, 4
Offset: 1
Keywords
Examples
a(10) = 5 because the residues (mod 10) of x^10 are 0, 1, 4, 5, 6, 9 and the sum 25 ==5 (mod 10).
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16384
- Antti Karttunen, Data supplement: n, a(n) computed for n = 1..65537
Programs
-
Maple
with(numtheory):sumDistRes := proc(n) local re, x, r ; re := {} ; for x from 0 to n-1 do re := re union { modp(x^n, n) } ; end do: add(r, r=re) ; end : for n from 1 to 150 do ; z:=irem(sumDistRes(n),n) ;printf("%d, ", z);end do: #
-
PARI
A196777(n) = (vecsum(Set(vector(n, k, lift(Mod(k-1, n)^n))))%n); \\ (After code in A195812) - Antti Karttunen, May 19 2021
Formula
a(n) = A195812(n) (mod n).
Comments