OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 3 because we need to add the primes 7, 11 and 13, to reach the greater of the twin prime pair (29 and 31).
MAPLE
f:= proc(p) local t, q, i;
t:= p; q:= p;
for i from 2 do
q:= nextprime(q);
t:= t+q;
if isprime(t) and isprime(t-2) then return i fi
od
end proc:
seq(f(ithprime(i)), i=1..100); # Robert Israel, May 08 2025
PROG
(Python)
import sympy
def a(n):
p=sympy.prime(n); s=p; c=1
p=sympy.nextprime(p); s+=p; c+=1
while not(sympy.isprime(s-2) and sympy.isprime(s)):p=sympy.nextprime(p); s+=p; c+=1
return c
(PARI) a(n) = my(p=prime(n), s=p, nb=1); while (!isprime(s-2) || !isprime(s) || (nb==1), p=nextprime(p+1); s+=p; nb++); nb; \\ Michel Marcus, Apr 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Abhiram R Devesh, Mar 08 2025
STATUS
approved
