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.

A371981 Number of primes between two successive Sophie Germain primes, with Sophie Germain primes not themselves included in the count.

Original entry on oeis.org

0, 0, 1, 3, 0, 2, 2, 6, 0, 5, 1, 7, 0, 1, 7, 0, 1, 5, 1, 9, 8, 1, 2, 7, 2, 10, 7, 2, 0, 3, 3, 3, 2, 4, 15, 5, 7, 0, 1, 2, 8, 14, 0, 7, 13, 4, 1, 3, 4, 0, 5, 3, 1, 17, 9, 9, 0, 2, 3, 5, 4, 1, 0, 7, 2, 14, 7, 2, 6, 0, 6, 7, 0, 18, 0, 6, 1, 7, 9, 3, 2, 0, 5, 28, 5, 3, 3, 2, 1, 5, 6, 7, 3, 15, 2
Offset: 1

Views

Author

Alexandre Herrera, Apr 15 2024

Keywords

Comments

Number of primes between A005384(n) and A005384(n+1).

Examples

			a(4) = 3 because there are 3 primes between 11 and 23: 13, 17 and 19.
		

Crossrefs

Programs

  • Mathematica
    -1 + Subtract @@ Map[PrimePi, {Last[#], First[#]}] & /@ Partition[Select[Prime[Range[500]], PrimeQ[2 # + 1] &], 2, 1] (* Michael De Vlieger, Apr 19 2024 *)
  • PARI
    lista(nn) = my(vp = select(p->isprime(2*p+1), primes(nn)), wp = apply(primepi, vp)); vector(#wp-1, k, wp[k+1]-wp[k]-1); \\ Michel Marcus, May 21 2024
  • Python
    from sympy import isprime
    l = []
    s = 0
    for i in range(3,3800):
        if isprime(i):
            if isprime(2*i + 1):
                l.append(s)
                s = 0
            else:
                s += 1
    print(l)
    

Formula

a(n) = A000720(A005384(n+1)) - A000720(A005384(n)) - 1. - Michael De Vlieger, Apr 19 2024