login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A359633
a(n) is the least prime > a(n-1) such that a(n-1) and a(n) are quadratic residues mod each other.
1
2, 7, 29, 53, 59, 137, 139, 173, 179, 193, 197, 223, 241, 251, 317, 353, 383, 389, 409, 419, 457, 461, 467, 541, 557, 563, 593, 601, 607, 701, 743, 761, 769, 773, 787, 797, 811, 853, 857, 859, 881, 883, 929, 937, 941, 947, 977, 991, 1009, 1013, 1019, 1033, 1039, 1049, 1051, 1097, 1129, 1153, 1171
OFFSET
1,1
COMMENTS
Quadratic reciprocity says that for odd primes p and q, if p is a quadratic residue mod q then q is a quadratic residue mod p except in the case where p and q are both congruent to 3 (mod 4), in which case they can't both be quadratic residues mod each other. Thus if a(n-1) == 1 (mod 4), a(n) is the least prime > a(n-1) that is a quadratic residue mod a(n-1), while if a(n-1) == 3 (mod 4), a(n) is the least prime > a(n-1) that is congruent to 1 (mod 4) and is a quadratic residue mod a(n-1).
LINKS
EXAMPLE
a(3) = 29 because a(2) = 7, 29 is a quadratic residue mod 7 and 7 is a quadratic residue mod 29, and 29 is the least prime > 7 that works.
MAPLE
f:= proc(p) local q;
q:= p;
do
q:= nextprime(q);
if NumberTheory:-QuadraticResidue(q, p) = 1 and NumberTheory:-QuadraticResidue(p, q) = 1 then return q fi
od
end proc:
A[1]:= 2: for i from 2 to 100 do A[i]:= f(A[i-1]) od:
seq(A[i], i=1..100);
CROSSREFS
Sequence in context: A116968 A162172 A274682 * A339868 A181758 A285790
KEYWORD
nonn
AUTHOR
Robert Israel, Jan 07 2023
STATUS
approved