A034795 a(n) is the least prime > a(n-1) that is a quadratic residue mod a(n-1).
2, 3, 7, 11, 23, 29, 53, 59, 71, 73, 79, 83, 109, 113, 127, 131, 151, 167, 173, 179, 191, 193, 197, 223, 227, 239, 241, 251, 263, 269, 283, 293, 307, 311, 313, 317, 353, 383, 389, 409, 419, 431, 433, 439, 443, 457, 461, 467, 479, 487, 491, 503, 509, 523, 547
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A034795.
Programs
-
Maple
f:= proc(p) local q; q:= p; do q:= nextprime(q); if NumberTheory:-QuadraticResidue(q,p)=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); # Robert Israel, Jan 06 2023
-
Mathematica
a[1] = 2; a[2] = 3; a[n_] := a[n] = For[p = NextPrime[a[n-1]], True, p = NextPrime[p], If[JacobiSymbol[p, a[n-1]] == 1, Return[p]]]; a /@ Range[55] (* Jean-François Alcover, Dec 28 2019 *) lpqr[n_]:=Module[{p=NextPrime[n]},While[JacobiSymbol[p,n]==-1,p=NextPrime[p]];p]; Join[{2},NestList[lpqr,3,60]] (* Harvey P. Dale, Dec 30 2024 *)
Extensions
Name corrected by Robert Israel, Jan 06 2023