OFFSET
1,1
COMMENTS
Also primes for which (p-1)/2 (==-1/2 mod p) is a primitive root. [Joerg Arndt, Jun 27 2011]
LINKS
Joerg Arndt, Table of n, a(n) for n = 1..10000
L. J. Goldstein, Density questions in algebraic number theory, Amer. Math. Monthly, 78 (1971), 342-349.
FORMULA
Let a(p,q)=sum(n=1,2*p*q,2*cos(2^n*Pi/((2*q+1)*(2*p+1)))). Then 2*p+1 is a prime belonging to this sequence when a(p,1)==1. - Gerry Martens, May 21 2015
MAPLE
with(numtheory); f:=proc(n) local t1, i, p; t1:=[]; for i from 1 to 500 do p:=ithprime(i); if order(n, p) = p-1 then t1:=[op(t1), p]; fi; od; t1; end; f(-2);
MATHEMATICA
pr=-2; Select[Prime[Range[200]], MultiplicativeOrder[pr, # ] == #-1 &] (* N. J. A. Sloane, Jun 01 2010 *)
a[p_, q_]:=Sum[2 Cos[2^n Pi/((2 q+1) (2 p+1))], {n, 1, 2 q p}];
Select[Range[400], Reduce[a[#, 1] == 1, Integers] &];
2 % + 1 (* Gerry Martens, Apr 28 2015 *)
PROG
(PARI) forprime(p=3, 10^4, if(p-1==znorder(Mod(-2, p)), print1(p", "))); /* Joerg Arndt, Jun 27 2011 */
(Python)
from sympy import n_order, nextprime
from itertools import islice
def A105874_gen(startvalue=3): # generator of terms >= startvalue
p = max(startvalue-1, 2)
while (p:=nextprime(p)):
if n_order(-2, p) == p-1:
yield p
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 24 2005
STATUS
approved