login
A195812
Sum of the distinct residues of x^n (mod n), x=0..n-1.
5
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,3
COMMENTS
a(n) has the following properties :
If n is a power of 2 then a(n)= 1 ;
Except for n = 9 where a(9)=9, if a(n) is the square of a prime p, the sequence shows that n is of the form n = 2p.
The numbers m such that a(m) are square are : 1, 2, 4, 8, 9, 10, 16, 26, 32, 34, 58, 64, 74, 81, ...
EXAMPLE
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.
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 *)
PROG
(PARI) a(n) = vecsum(Set(vector(n, k, lift(Mod(k-1, n)^n)))); \\ Michel Marcus, Jun 01 2015
CROSSREFS
Sequence in context: A084178 A262030 A260178 * A264491 A144697 A185419
KEYWORD
nonn
AUTHOR
Michel Lagneau, Oct 05 2011
STATUS
approved