%I #25 Jun 30 2024 22:00:32
%S 7,11,13,17,29,41,59,79,101,103,107,113,139,163,181,193,227,257,269,
%T 311,359,379,397,419,421,439,461,487,491,547,569,577,599,691,701,709,
%U 761,811,823,857,863,881,887,919,983,1021,1049,1051,1091,1109,1163
%N Numbers prime(k) such that prime(k) - prime(k-1) = prime(k+2) - prime(k+1).
%H Robert Israel, <a href="/A373299/b373299.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A151800(A022885(n)).
%e 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.
%p P:= select(isprime,[seq(i,i=3..10^4,2)]):
%p G:= P[2..-1]-P[1..-2]: nG:= nops(G):
%p J:= select(t -> G[t-1]=G[t+1],[$2..nG-1]):
%p P[J]; # _Robert Israel_, May 31 2024
%t Select[Partition[Prime[Range[200]], 4, 1], #[[2]] - #[[1]] == #[[4]] - #[[3]] &][[;; , 2]] (* _Amiram Eldar_, May 31 2024 *)
%o (Python)
%o from sympy import prime
%o def ok(k):
%o return prime(k)-prime(k-1) == prime(k+2)-prime(k+1)
%o print([prime(k) for k in range(2,200) if ok(k)])
%o (Python)
%o from sympy import nextprime
%o from itertools import islice
%o def agen(): # generator of terms
%o p, q, r, s = [2, 3, 5, 7]
%o while True:
%o if q-p == s-r: yield q
%o p, q, r, s = q, r, s, nextprime(s)
%o print(list(islice(agen(), 60))) # _Michael S. Branicky_, May 31 2024
%Y Cf. A001223, A022885, A151800, A263674.
%K nonn
%O 1,1
%A _Alexandre Herrera_, May 31 2024