OFFSET
1,4
FORMULA
EXAMPLE
a(4) = 3 because there are 3 primes between 11 and 23: 13, 17 and 19.
MATHEMATICA
-1 + Subtract @@ Map[PrimePi, {Last[#], First[#]}] & /@ Partition[Select[Prime[Range[500]], PrimeQ[2 # + 1] &], 2, 1] (* Michael De Vlieger, Apr 19 2024 *)
PROG
(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)
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Alexandre Herrera, Apr 15 2024
STATUS
approved