OFFSET
1,1
EXAMPLE
a(3) = 23 because 23, 29, 31 are consecutive primes with 29-23 = 3*(31-29) and 23 is the first prime that works.
MAPLE
V:= Vector(45): count:= 0:
q:= 2: r:= 3:
while count < 45 do
p:= q; q:= r; r:= nextprime(r);
v:= (q-p)/(r-q);
if v::integer and v <= 45 and V[v] = 0 then
count:= count+1; V[v]:= p;
fi
od:
convert(V, list);
PROG
(Python)
from sympy import nextprime
from itertools import count, islice
def agen():
p, q, r, n, adict = 2, 3, 5, 1, dict()
while True:
v, rem = divmod(q-p, r-q)
if rem == 0 and v not in adict: adict[v] = p
while n in adict: yield adict[n]; n += 1
p, q, r = q, r, nextprime(r)
print(list(islice(agen(), 21))) # Michael S. Branicky, Dec 07 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel and Juri-Stepan Gerasimov, Dec 07 2022
STATUS
approved