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.

A356745 a(n) is the first prime that starts a string of exactly n consecutive primes where the prime + the next prime + 1 is prime.

Original entry on oeis.org

37, 5, 283, 929, 13, 696607, 531901, 408079937, 17028422981
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Sep 17 2022

Keywords

Comments

a(n) is the first prime p(k) such that p(k+i)+p(k+i+1)+1 is prime for i from 0 to n-1, but not for i=-1 or n.

Examples

			a(5) = 13 because 13+17+1 = 31, 17+19+1 = 37, 19+23+1 = 43, 23+29+1 = 53, and 29+31+1 = 61 are prime, but 11+13+1 = 25 and 31+37+1 = 69 are not, and 13 is the first prime that works.
		

Crossrefs

Cf. A177017.

Programs

  • Maple
    P:= select(isprime, [seq(i,i=3..10^6,2)]):
    V:= Vector(7):
    state:= 0:
    for i from 1 to nops(P)-1 do
    if isprime(P[i]+P[i+1]+1) then
      state:= state+1
    else
      if state > 0 and V[state] = 0 then V[state]:= P[i-state] fi;
      state:= 0
    fi
    od:
    convert(V,list);
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime
    def f(p):
        c, p0, p1 = 0, p, nextprime(p)
        while isprime(p0+p1+1):
            c, p0, p1 = c+1, p1, nextprime(p1)
        return c, p1
    def agen():
        n, adict, pk = 1, dict(), 2
        for k in count(1):
            fk, pk2 = f(pk)
            if fk not in adict: adict[fk] = pk
            while n in adict: yield adict[n]; n += 1
            pk = pk2
    print(list(islice(agen(), 7))) # Michael S. Branicky, Sep 18 2022

Extensions

a(8)-a(9) from Michael S. Branicky, Sep 18 2022