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.

A179067 Orders of consecutive clusters of twin primes.

Original entry on oeis.org

1, 3, 1, 1, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Franz Vrabec, Jun 27 2010

Keywords

Comments

For k>=1, 2k+4 consecutive primes P1, P2, ..., P2k+4 defining a cluster of twin primes of order k iff P2-P1 <> 2, P4-P3 = P6-P5 = ... = P2k+2 - P2k+1 = 2, P2k+4 - P2k+3 <> 2.
Also the lengths of maximal runs of terms differing by 2 in A029707 (leading index of twin primes), complement A049579. - Gus Wiseman, Dec 05 2024

Examples

			The twin prime cluster ((101,103),(107,109)) of order k=2 stems from the 2k+4 = 8 consecutive primes (89, 97, 101, 103, 107, 109, 113, 127) because 97-89 <> 2, 103-101 = 109-107 = 2, 127-113 <> 2.
From _Gus Wiseman_, Dec 05 2024: (Start)
The leading indices of twin primes are:
  2, 3, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, 52, ...
with maximal runs of terms differing by 2:
  {2}, {3,5,7}, {10}, {13}, {17}, {20}, {26,28}, {33,35}, {41,43,45}, {49}, {52}, ...
with lengths a(n).
(End)
		

Crossrefs

Cf. A077800.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A006512 gives the greater of twin primes.
A029707 gives the leading index of twin primes, complement A049579.
A038664 finds the first prime gap of length 2n.
A046933 counts composite numbers between primes.

Programs

  • Maple
    R:= 1: count:= 1: m:= 0:
    q:= 5: state:= 1:
    while count < 100 do
     p:= nextprime(q);
     if state = 1 then
        if p-q = 2 then state:= 2; m:= m+1;
        else
          if m > 0 then R:= R,m; count:= count+1; fi;
          m:= 0
        fi
     else state:= 1;
     fi;
     q:= p
    od:
    R; # Robert Israel, Feb 07 2023
  • Mathematica
    Length/@Split[Select[Range[2,100],Prime[#+1]-Prime[#]==2&],#2==#1+2&] (* Gus Wiseman, Dec 05 2024 *)
  • PARI
    a(n)={my(o,P,L=vector(3));n++;forprime(p=o=3,,L=concat(L[2..3],-o+o=p);L[3]==2||next;L[1]==2&&(P=concat(P,p))&&next;n--||return(#P);P=[p])} \\ M. F. Hasler, May 04 2015

Extensions

More terms from M. F. Hasler, May 04 2015