A229899
a(n) = |{0
0, 0, 0, 0, 1, 0, 2, 1, 1, 0, 1, 2, 2, 2, 4, 6, 7, 0, 1, 2, 2, 1, 10, 10, 8, 4, 4, 13, 4, 6, 3, 5, 10, 3, 20, 2, 6, 6, 19, 18, 22, 4, 11, 6, 16, 4, 3, 7, 28, 8, 28, 16, 4, 16, 32, 31, 30, 5, 8, 16, 13, 32, 7, 17, 6, 40, 7, 2, 43, 8, 36, 43, 10, 12, 8, 46, 44, 8, 30, 16, 39, 8, 24, 20, 11, 39, 30, 14, 22, 9, 58, 58, 22, 17, 22, 61, 60, 30, 21, 10
Offset: 1
Keywords
Examples
a(5) = 1 since 6, 7, 8 are primitive roots modulo p_5 = 11. a(7) = 2 since 5, 6, 7, 10, 11, 12 are primitive roots modulo p_7 = 17. a(8) = 1 since 13, 14, 15 are primitive roots modulo p_8 = 19.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..400
Crossrefs
Cf. A001918.
Programs
-
Mathematica
gp[g_,p_]:=gp[g,p]=Length[Union[Table[Mod[g^k, p],{k,1,p-1}]]]==p-1 a[n_]:=Sum[If[gp[g,Prime[n]]&&gp[g-1,Prime[n]]&&gp[g+1,Prime[n]],1,0],{g,1,Prime[n]-1}] Table[a[n],{n,1,100}]
Comments