OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..733
EXAMPLE
a(3) = 5 because 5 is prime and a(2) + 5 = 8 is divisible by a(1) = 2.
a(4) = 7 because 7 is prime and a(3) + 7 = 12 is divisible by a(2) = 3.
a(5) = 13 because 13 is prime and a(4) + 13 = 20 is divisible by a(3) = 5.
MAPLE
p:= 2: q:= 3: R:= p, q: t:= 3: count:= 2:
while count < 40 do
t:= t + p;
if isprime(t) then
R:= R, t; count:= count+1;
p:= q; q:= t;
t:= floor(2*q/p)*p-q;
fi
od:
R;
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov and Robert Israel, Mar 31 2023
STATUS
approved