A071782 Sum of distinct squares in Z_n (mod n).
0, 1, 1, 1, 0, 2, 0, 5, 3, 5, 0, 2, 0, 0, 0, 14, 0, 6, 0, 15, 7, 0, 0, 18, 0, 13, 18, 0, 0, 0, 0, 8, 0, 17, 0, 24, 0, 0, 13, 15, 0, 14, 0, 22, 0, 0, 0, 28, 0, 25, 0, 39, 0, 9, 0, 28, 19, 29, 0, 30, 0, 0, 21, 32, 0, 0, 0, 17, 0, 0, 0, 36, 0, 37, 50, 38, 0, 26, 0, 10
Offset: 1
Keywords
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16848
Programs
-
Mathematica
a[n_] := Mod[Apply[Plus, Union[Table[Mod[i^2, n], {i, 1, n}]]], n]
-
PARI
A071782(n) = (vecsum(Set(vector(n,i,(i^2)%n)))%n); \\ Antti Karttunen, Feb 18 2023
Comments