OFFSET
1,1
COMMENTS
If p is a prime, then a is called a semiprimitive root if it has order (p-1)/2 and there is no x for which a^x is congruent to -1 (mod p). So +- a^k, 0 <= k <= (p-3)/2 is a complete set of nonzero residues (mod p). A primitive root has order p-1, so a number cannot be both a primitive root and a semiprimitive root.
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
Since A139035(13)=311, 2 is a semiprimitive root of 311 so j=0,...,154, {+-2^j} is a complete set of residues (congruent to {1,...,310}). The corresponding member of this sequence is a(13)=17 because 17 is the smallest positive integer a for which {a^k}, k=0,...,309 is a complete set of residues.
MATHEMATICA
PrimitiveRoot /@ Reap[For[p = 3, p < 3000, p = NextPrime[p], rp = MultiplicativeOrder[2, p]; rm = MultiplicativeOrder[-2, p]; If[rp != p-1 && rm == p-1, Sow[p]]]][[2, 1]] (* Jean-François Alcover, Sep 03 2016, after Joerg Arndt's code for A139035 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Jan 11 2011
EXTENSIONS
More terms from Jean-François Alcover, Sep 03 2016
STATUS
approved