OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
7 is in the list because the prime previous to 7 is 5 and the next primes after 7 are 11 and 13, so we have 7 - 5 = 13 - 11 = 2.
MAPLE
P:= select(isprime, [seq(i, i=3..10^4, 2)]):
G:= P[2..-1]-P[1..-2]: nG:= nops(G):
J:= select(t -> G[t-1]=G[t+1], [$2..nG-1]):
P[J]; # Robert Israel, May 31 2024
MATHEMATICA
Select[Partition[Prime[Range[200]], 4, 1], #[[2]] - #[[1]] == #[[4]] - #[[3]] &][[;; , 2]] (* Amiram Eldar, May 31 2024 *)
PROG
(Python)
from sympy import prime
def ok(k):
return prime(k)-prime(k-1) == prime(k+2)-prime(k+1)
print([prime(k) for k in range(2, 200) if ok(k)])
(Python)
from sympy import nextprime
from itertools import islice
def agen(): # generator of terms
p, q, r, s = [2, 3, 5, 7]
while True:
if q-p == s-r: yield q
p, q, r, s = q, r, s, nextprime(s)
print(list(islice(agen(), 60))) # Michael S. Branicky, May 31 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Alexandre Herrera, May 31 2024
STATUS
approved