cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A373299 Numbers prime(k) such that prime(k) - prime(k-1) = prime(k+2) - prime(k+1).

Original entry on oeis.org

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

Views

Author

Alexandre Herrera, May 31 2024

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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

Formula

a(n) = A151800(A022885(n)).