login

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”).

A373299
Numbers prime(k) such that prime(k) - prime(k-1) = prime(k+2) - prime(k+1).
1
7, 11, 13, 17, 29, 41, 59, 79, 101, 103, 107, 113, 139, 163, 181, 193, 227, 257, 269, 311, 359, 379, 397, 419, 421, 439, 461, 487, 491, 547, 569, 577, 599, 691, 701, 709, 761, 811, 823, 857, 863, 881, 887, 919, 983, 1021, 1049, 1051, 1091, 1109, 1163
OFFSET
1,1
LINKS
FORMULA
a(n) = A151800(A022885(n)).
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