|
|
A358974
|
|
a(n) is the least prime p such that q-p = n*(r-q) where p,q,r are consecutive primes.
|
|
0
|
|
|
3, 7, 23, 6397, 139, 509, 84871, 1933, 1259, 43331, 1129, 4523, 933073, 2971, 6917, 1568771, 9973, 32261, 4131109, 25261, 78737, 12809359, 91033, 28229, 13626257, 35677, 117443, 37305713, 399793, 102701, 217795247, 288583, 296843, 240485257, 173359, 1025957, 213158279, 1053103, 370949, 1163010181
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
a(n) = prime(k) for the first k such that A001223(k) = n*A001223(k+1).
|
|
LINKS
|
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|