OFFSET
1,2
COMMENTS
a(n) is the number of primes between prime(n) and prime(n) + prime(n+1).
Conjecture: for n >= 3, a(n) < n.
LINKS
Patrick Butler, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
For n = 5 prime(n) = 11. prime(5) + prime(6) = 11+13=24. The 4th prime after 13 is 29 which is the next prime after 13 greater than or equal to 24. So a(5) = 4.
MAPLE
R:= 1: pn:= 2: pn1:= 3: p:=5: m:= 4: pp:= 7:
for n from 2 to 100 do
pn:= pn1; pn1:= nextprime(pn1);
while pp <= pn + pn1 do m:= m+1; pp:= nextprime(pp); od;
R:= R, m-n-1;
od:
R; # Robert Israel, Oct 31 2023
MATHEMATICA
PROG
(Python)
m=0
#list here is a list of prime numbers A000040.
def a(n):
global list
sum= list[n]+list[n+1]
i=n+2
while True:
if(list[i]>=sum):
m=i
break
i=i+1
k = m-(n+1)
return k
#
#calculate the terms of the sequence a(n).
seq = []
for n in range(0, firstN):
seq.append(a(n))
(PARI) a(n) = my(k=1, q=prime(n)+prime(n+1)); while(prime(n+k) < q, k++); k; \\ Michel Marcus, Oct 06 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Patrick Butler, Oct 05 2023
STATUS
approved