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.

Original entry on oeis.org

2, 137, 95, 3, 339, 93, 51, 5, 49, 5, 3, 115, 91, 35, 331, 7, 11, 3, 19, 29, 5, 187, 515, 15, 13, 79, 203, 11, 3, 69, 9, 93, 7, 13, 13, 5, 189, 71, 289, 419, 35, 239, 11, 9, 9, 33, 3, 129, 57, 75, 71, 53, 23, 121, 523, 13, 11, 3, 9, 11, 3, 193, 87, 5, 23, 181, 115, 3
Offset: 1

Views

Author

Abhiram R Devesh, Mar 08 2025

Keywords

Examples

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

Crossrefs

Programs

  • 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
  • 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
  • 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