OFFSET
1,2
COMMENTS
All odd prime numbers are in the sequence.
The sum of the distinct residues is 0, 1, 3, 1, 10, 8, 21, 1, 9, 25, 55, 14, 78, 42, 105, 1, 136,.. for n>=1.
EXAMPLE
n= 14 is in the sequence because x^14 == 0, 1, 2, 4, 7, 8, 9, or 11 (mod 14), and the sum 0+1+2+4+7+8+9+11 = 42 is divisible by 14.
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
if sumDistRes(n) mod n = 0 then
printf("%d, ", n);
end if;
end do: # R. J. Mathar, Oct 04 2011
MATHEMATICA
sumDistRes[n_] := Module[{re = {}, x}, For[x = 0, x <= n-1, x++, re = re ~Union~ {PowerMod[x, n, n]}]; Total[re]];
Select[Range[100], Mod[sumDistRes[#], #] == 0&] (* Jean-François Alcover, Oct 20 2023, after R. J. Mathar *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Oct 03 2011
STATUS
approved