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.

A381868 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.

This page as a plain text file.
%I A381868 #24 May 12 2025 14:38:25
%S A381868 2,137,95,3,339,93,51,5,49,5,3,115,91,35,331,7,11,3,19,29,5,187,515,
%T A381868 15,13,79,203,11,3,69,9,93,7,13,13,5,189,71,289,419,35,239,11,9,9,33,
%U A381868 3,129,57,75,71,53,23,121,523,13,11,3,9,11,3,193,87,5,23,181,115,3
%N A381868 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 A381868 Robert Israel, <a href="/A381868/b381868.txt">Table of n, a(n) for n = 1..10000</a>
%e A381868 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 A381868 f:= proc(p) local t,q,i;
%p A381868   t:= p; q:= p;
%p A381868   for i from 2 do
%p A381868     q:= nextprime(q);
%p A381868     t:= t+q;
%p A381868     if isprime(t) and isprime(t-2) then return i fi
%p A381868   od
%p A381868 end proc:
%p A381868 seq(f(ithprime(i)),i=1..100); # _Robert Israel_, May 08 2025
%o A381868 (Python)
%o A381868 import sympy
%o A381868 def a(n):
%o A381868    p=sympy.prime(n); s=p; c=1
%o A381868    p=sympy.nextprime(p); s+=p; c+=1
%o A381868    while not(sympy.isprime(s-2) and sympy.isprime(s)):p=sympy.nextprime(p); s+=p; c+=1
%o A381868    return c
%o A381868 (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 A381868 Cf. A006512, A381855, A381766.
%K A381868 nonn
%O A381868 1,1
%A A381868 _Abhiram R Devesh_, Mar 08 2025