This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A034795 #18 Dec 30 2024 13:14:13 %S A034795 2,3,7,11,23,29,53,59,71,73,79,83,109,113,127,131,151,167,173,179,191, %T A034795 193,197,223,227,239,241,251,263,269,283,293,307,311,313,317,353,383, %U A034795 389,409,419,431,433,439,443,457,461,467,479,487,491,503,509,523,547 %N A034795 a(n) is the least prime > a(n-1) that is a quadratic residue mod a(n-1). %H A034795 Robert Israel, <a href="/A034795/b034795.txt">Table of n, a(n) for n = 1..10000</a> %p A034795 f:= proc(p) local q; %p A034795 q:= p; %p A034795 do %p A034795 q:= nextprime(q); %p A034795 if NumberTheory:-QuadraticResidue(q,p)=1 then return q fi %p A034795 od %p A034795 end proc: %p A034795 A[1]:= 2: for i from 2 to 100 do A[i]:= f(A[i-1]) od: %p A034795 seq(A[i],i=1..100); # _Robert Israel_, Jan 06 2023 %t A034795 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]]]; %t A034795 a /@ Range[55] (* _Jean-François Alcover_, Dec 28 2019 *) %t A034795 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 *) %Y A034795 Cf. A034795. %K A034795 nonn,nice %O A034795 1,1 %A A034795 _David W. Wilson_ %E A034795 Name corrected by _Robert Israel_, Jan 06 2023