OFFSET
1,5
COMMENTS
Gauss proved that the sum of the primitive roots of p is congruent to moebius(p-1) modulo p, for all primes p. - Jonathan Sondow, Feb 09 2013
LINKS
Wikipedia, Primitive root
EXAMPLE
The primitive roots of prime(4) = 7 are 3 and 5, and moebius(7-1) = A008683(6) = 1, so a(4) = (3+5-1)/7 = 7/7 = 1. - Jonathan Sondow, Feb 10 2013
MATHEMATICA
PrimitiveRootQ[ a_Integer, p_Integer ] := Block[ {fac, res}, fac = FactorInteger[ p - 1 ]; res = Table[ PowerMod[ a, ( p - 1)/fac[ [ i, 1 ] ], p ], {i, Length[ fac ]} ]; ! MemberQ[ res, 1 ] ] PrimitiveRoots[ p_Integer ] := Select[ Range[ p - 1 ], PrimitiveRootQ[ #, p ] & ] Table[ (Total[ PrimitiveRoots[ Prime[ n ] ] ] - MoebiusMu[ Prime[ n ] - 1 ])/Prime[ n ], {n, 1, 100} ]
a[n_] := With[{p = Prime[n]}, Select[Range[p - 1], MultiplicativeOrder[#, p] == p - 1 &]]; Table[(Sum[a[n][[i]], {i, Length[a[n]]}] - MoebiusMu[Prime[n] - 1])/Prime[n], {n, 1, 10}] (* Jonathan Sondow, Feb 09 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ed Pegg Jr, Nov 03 2003
EXTENSIONS
Definition corrected by Jonathan Sondow, Feb 09 2013
STATUS
approved