login
Starting from the n-th prime, a(n) is the minimum number > 1 of consecutive primes whose sum is the greater of a twin prime pair.
2

%I #24 May 12 2025 14:38:25

%S 2,137,95,3,339,93,51,5,49,5,3,115,91,35,331,7,11,3,19,29,5,187,515,

%T 15,13,79,203,11,3,69,9,93,7,13,13,5,189,71,289,419,35,239,11,9,9,33,

%U 3,129,57,75,71,53,23,121,523,13,11,3,9,11,3,193,87,5,23,181,115,3

%N Starting from the n-th prime, a(n) is the minimum number > 1 of consecutive primes whose sum is the greater of a twin prime pair.

%H Robert Israel, <a href="/A381868/b381868.txt">Table of n, a(n) for n = 1..10000</a>

%e 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).

%p f:= proc(p) local t,q,i;

%p t:= p; q:= p;

%p for i from 2 do

%p q:= nextprime(q);

%p t:= t+q;

%p if isprime(t) and isprime(t-2) then return i fi

%p od

%p end proc:

%p seq(f(ithprime(i)),i=1..100); # _Robert Israel_, May 08 2025

%o (Python)

%o import sympy

%o def a(n):

%o p=sympy.prime(n); s=p; c=1

%o p=sympy.nextprime(p); s+=p; c+=1

%o while not(sympy.isprime(s-2) and sympy.isprime(s)):p=sympy.nextprime(p); s+=p; c+=1

%o return c

%o (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

%Y Cf. A006512, A381855, A381766.

%K nonn

%O 1,1

%A _Abhiram R Devesh_, Mar 08 2025