A195812 Sum of the distinct residues of x^n (mod n), x=0..n-1.
0, 1, 3, 1, 10, 8, 21, 1, 9, 25, 55, 14, 78, 42, 105, 1, 136, 20, 171, 22, 84, 110, 253, 26, 50, 169, 27, 84, 406, 150, 465, 1, 528, 289, 595, 38, 666, 342, 273, 42, 820, 130, 903, 198, 315, 460, 1081, 50, 147, 125, 1275, 156, 1378, 56, 385, 140, 570, 841
Offset: 1
Keywords
Examples
a(10) = 25 because the residues (mod 10) of x^10 are 0, 1, 4, 5, 6, 9 and the sum 25 is a square => a(10) = a(2*5)= 5^2.
Links
- Zak Seidov, Table of n, a(n) for n = 1..1000
Programs
-
Maple
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 proc: for n from 1 to 100 do printf("%d, ", sumDistRes(n)); end do: # (Program of R. J. Mathar - see A196546)
-
Mathematica
Table[{m,Total[Union[Table[PowerMod[x,m,m],{x,m-1}]]]},{m,1000}] (* Zak Seidov, Oct 06 2011 *)
-
PARI
a(n) = vecsum(Set(vector(n, k, lift(Mod(k-1,n)^n)))); \\ Michel Marcus, Jun 01 2015
Comments