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”).
%I #12 Apr 02 2023 08:39:37
%S 2,3,5,7,13,29,101,131,677,2467,5657,19013,48871,521519,553643,
%T 3618509,14098067,116168257,193989217,1200029867,8887409417,
%U 12713128189,573855893333,773735694701,9555670385293,30678585739159,160434821966701,1312137293512931,2217428789754491,100129280104254127
%N For n > 2, a(n) is the least prime p > a(n-1) such that a(n-1) + p is divisible by a(n-2); a(1) = 2, a(2) = 3.
%H Robert Israel, <a href="/A359483/b359483.txt">Table of n, a(n) for n = 1..733</a>
%e a(3) = 5 because 5 is prime and a(2) + 5 = 8 is divisible by a(1) = 2.
%e a(4) = 7 because 7 is prime and a(3) + 7 = 12 is divisible by a(2) = 3.
%e a(5) = 13 because 13 is prime and a(4) + 13 = 20 is divisible by a(3) = 5.
%p p:= 2: q:= 3: R:= p,q: t:= 3: count:= 2:
%p while count < 40 do
%p t:= t + p;
%p if isprime(t) then
%p R:= R, t; count:= count+1;
%p p:= q; q:= t;
%p t:= floor(2*q/p)*p-q;
%p fi
%p od:
%p R;
%t nmax=17; a[1]=2; a[2]=3; For[n=3, n<=nmax, n++, For[k=1, k>0, k++, If[Prime[k]>a[n-1] && Mod[a[n-1]+Prime[k], a[n-2]]==0, a[n]=Prime[k]; k=-1]]]; Array[a,nmax] (* _Stefano Spezia_, Apr 01 2023 *)
%K nonn
%O 1,1
%A _Zak Seidov_ and _Robert Israel_, Mar 31 2023