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.

Showing 1-8 of 8 results.

A029707 Numbers n such that the n-th and the (n+1)-st primes are twin primes.

Original entry on oeis.org

2, 3, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, 52, 57, 60, 64, 69, 81, 83, 89, 98, 104, 109, 113, 116, 120, 140, 142, 144, 148, 152, 171, 173, 176, 178, 182, 190, 201, 206, 209, 212, 215, 225, 230, 234, 236, 253, 256, 262, 265, 268, 277
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Numbers m such that prime(m)^2 == 1 mod (prime(m) + prime(m + 1)). - Zak Seidov, Sep 18 2013
First differences are A027833. The complement is A049579. - Gus Wiseman, Dec 03 2024

Crossrefs

Cf. A014574, A027833 (first differences), A007508. Equals PrimePi(A001359) (cf. A000720).
The complement is A049579, first differences A251092 except first term.
Lengths of runs of terms differing by 2 are A179067.
The first differences have run-lengths A373820 except first term.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A038664 finds the first prime gap of 2n.
A046933 counts composite numbers between primes.
For prime runs: A005381, A006512, A025584, A067774.

Programs

  • Maple
    A029707 := proc(n)
        numtheory[pi](A001359(n)) ;
    end proc:
    seq(A029707(n),n=1..30); # R. J. Mathar, Feb 19 2017
  • Mathematica
    Select[ Range@300, PrimeQ[ Prime@# + 2] &] (* Robert G. Wilson v, Mar 11 2007 *)
    Flatten[Position[Flatten[Differences/@Partition[Prime[Range[100]],2,1]], 2]](* Harvey P. Dale, Jun 05 2014 *)
  • Sage
    def A029707(n) :
       a = [ ]
       for i in (1..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i)
       return(a)
    A029707(277) # Jani Melik, May 15 2014

Formula

a(n) = A107770(n) - 1. - Juri-Stepan Gerasimov, Dec 16 2009

A027833 Distances between successive 2's in sequence A001223 of differences between consecutive primes.

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 3, 6, 2, 5, 2, 6, 2, 2, 4, 3, 5, 3, 4, 5, 12, 2, 6, 9, 6, 5, 4, 3, 4, 20, 2, 2, 4, 4, 19, 2, 3, 2, 4, 8, 11, 5, 3, 3, 3, 10, 5, 4, 2, 17, 3, 6, 3, 3, 9, 9, 2, 6, 2, 6, 5, 6, 2, 3, 2, 3, 9, 4, 7, 3, 7, 20, 4, 7, 6, 5, 3, 7, 3, 20, 2, 14, 4, 10, 2, 3, 6, 4, 2, 2, 7, 2, 6, 3
Offset: 1

Views

Author

Jean-Marc MALASOMA (Malasoma(AT)entpe.fr)

Keywords

Comments

a(n) = number of primes p such that A014574(n) < p < A014574(n+1). - Thomas Ordowski, Jul 20 2012
Conjecture: a(n) < log(A014574(n))^2. - Thomas Ordowski, Jul 21 2012
Conjecture: All positive integers are represented in this sequence. This is verified up to 184, by searching up to prime indexes of ~128000000. The rate of filling-in the smallest remaining gap among the integers, and the growth in the maximum value found, both slow down considerably relative to a fixed quantity of twin prime incidences examined in each pass. The maximum value found was 237. - Richard R. Forberg, Jul 28 2016
All positive integers below 312 are in this sequence. - Charles R Greathouse IV, Aug 01 2016
From Gus Wiseman, Jun 11 2024: (Start)
Also the length of the n-th maximal antirun of prime numbers > 3, where an antirun is an interval of positions at which consecutive terms differ by more than 2. These begin:
5
7 11
13 17
19 23 29
31 37 41
43 47 53 59
61 67 71
73 79 83 89 97 101
(End)

Crossrefs

First differences of A029707 and A155752 = A029707 - 1. M. F. Hasler, Jul 24 2012
Positions of first appearances are A373401, sorted A373402.
Functional neighbors: A001359, A006512, A251092 or A175632, A373127 (firsts A373128, sorted A373200), A373403, A373405, A373409.
A000040 lists the primes, differences A001223.
A002808 lists the composite numbers, differences A073783.
A046933 counts composite numbers between primes.
A065855 counts composite numbers up to n.

Programs

  • Maple
    A027833 := proc(n)
        local plow,phigh ;
        phigh := A001359(n+1) ;
        plow := A001359(n) ;
        numtheory[pi](phigh)-numtheory[pi](plow) ;
    end proc:
    seq(A027833(n),n=1..100) ; # R. J. Mathar, Jan 20 2025
  • Mathematica
    Differences[Flatten[Position[Differences[Prime[Range[500]]],2]]] (* Harvey P. Dale, Nov 17 2018 *)
    Length/@Split[Select[Range[4,10000],PrimeQ[#]&],#1+2!=#2&]//Most (* Gus Wiseman, Jun 11 2024 *)
  • PARI
    n=1; p=5; forprime(q=7,1e3, if(q-p==2, print1(n", "); n=1, n++); p=q) \\ Charles R Greathouse IV, Aug 01 2016
  • Sage
    def A027833(n) :
       a = [ ]
       st = 2
       for i in (3..n) :
          if (nth_prime(i+1)-nth_prime(i) == 2) :
             a.append(i-st)
             st = i
       return(a)
    A027833(496) # Jani Melik, May 15 2014
    

A068361 Numbers n such that the number of squarefree numbers between prime(n) and prime(n+1) = prime(n+1)-prime(n)-1.

Original entry on oeis.org

1, 3, 10, 13, 26, 33, 60, 89, 104, 113, 116, 142, 148, 201, 209, 212, 234, 265, 268, 288, 313, 320, 332, 343, 353, 384, 398, 408, 477, 484, 498, 542, 545, 551, 577, 581, 601, 625, 636, 671, 719, 723, 726, 745, 794, 805, 815, 862, 864, 884, 944, 964, 995, 1054
Offset: 1

Views

Author

Benoit Cloitre, Feb 28 2002

Keywords

Comments

Also numbers k such that all numbers from prime(k) to prime(k+1) are squarefree. All such primes are twins, so this is a subset of A029707. The other twin primes are A061368. - Gus Wiseman, Dec 11 2024

Crossrefs

A subset of A029707 (lesser index of twin primes).
Prime index of each (prime) term of A061351.
Positions of zeros in A061399.
For perfect power instead of squarefree we have A377436, zeros of A377432.
Positions of zeros in A377784.
The rest of the twin primes are at A378620, indices of A061368.
A000040 lists the primes, differences A001223, (run-lengths A333254, A373821).
A005117 lists the squarefree numbers, differences A076259.
A006562 finds balanced primes.
A013929 lists the nonsquarefree numbers, differences A078147.
A014574 is the intersection of A006093 and A008864.
A038664 locates the first prime gap of size 2n.
A046933 counts composite numbers between primes.
A061398 counts squarefree numbers between primes, zeros A068360.
A120327 gives the least nonsquarefree number >= n.

Programs

  • Mathematica
    Select[Range[100],And@@SquareFreeQ/@Range[Prime[#],Prime[#+1]]&] (* Gus Wiseman, Dec 11 2024 *)
  • PARI
    isok(n) = for (k=prime(n)+1, prime(n+1)-1, if (!issquarefree(k), return (0))); 1; \\ Michel Marcus, Apr 29 2016

Formula

n such that A061398(n) = prime(n+1)-prime(n)-1.
prime(a(n)) = A061351(n). - Gus Wiseman, Dec 11 2024

A049579 Numbers k such that prime(k)+2 divides (prime(k)-1)!.

Original entry on oeis.org

4, 6, 8, 9, 11, 12, 14, 15, 16, 18, 19, 21, 22, 23, 24, 25, 27, 29, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 46, 47, 48, 50, 51, 53, 54, 55, 56, 58, 59, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95
Offset: 1

Views

Author

Keywords

Comments

Numbers k such that prime(k+1) - prime(k) does not divide prime(k+1) + prime(k). These are the numbers k for which prime(k+1) - prime(k) > 2. - Thomas Ordowski, Mar 31 2022
If we prepend 1, the first differences are A251092 (see also A175632). The complement is A029707. - Gus Wiseman, Dec 03 2024

Examples

			prime(4) = 7, 6!+1 = 721 gives residue 1 when divided by prime(4)+2 = 9.
		

Crossrefs

The first differences are A251092 except first term, run-lengths A373819.
The complement is A029707.
Runs of terms differing by one have lengths A027833, min A107770, max A155752.
A000040 lists the primes, differences A001223 (run-lengths A333254, A373821).
A038664 finds the first prime gap of difference 2n.
A046933 counts composite numbers between primes.
A071148 gives partial sums of odd primes.

Programs

  • Mathematica
    pnmQ[n_]:=Module[{p=Prime[n]},Mod[(p-1)!+1,p+2]==1]; Select[Range[ 100],pnmQ] (* Harvey P. Dale, Jun 24 2017 *)
  • PARI
    isok(n) = (((prime(n)-1)! + 1) % (prime(n)+2)) == 1; \\ Michel Marcus, Dec 31 2013

Extensions

Definition edited by Thomas Ordowski, Mar 31 2022

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

A336411 a(n) = A029707(n+2) - 3 for n >= 1.

Original entry on oeis.org

2, 4, 7, 10, 14, 17, 23, 25, 30, 32, 38, 40, 42, 46, 49, 54, 57, 61, 66, 78, 80, 86, 95, 101, 106, 110, 113, 117, 137, 139, 141, 145, 149, 168, 170, 173, 175, 179, 187, 198, 203, 206, 209, 212, 222, 227, 231, 233, 250, 253, 259, 262, 265, 274, 283, 285, 291
Offset: 1

Views

Author

Clark Kimberling, Sep 06 2020

Keywords

Comments

Previous name was "Numbers k such that prime(k) - oc(k) = 4, where oc(k) is the greatest odd composite < prime(k)".

Crossrefs

Programs

  • Mathematica
    z = 5000; d = Select[Range[2, z], ! PrimeQ@# && OddQ@# &];  (* A014076 *)
    f[n_] := Select[d, # < Prime[n] &];
    t = Table[Prime[n] - Max[f[n]], {n, 5, 300}]  (* A336409 *)
    Flatten[Position[t, 2]]  (* A336410 *)
    Flatten[Position[t, 4]]  (* this sequence *)

Formula

a(n) = A029707(n+2) - 3 = A155752(n+2) - 2. - Hugo Pfoertner, Oct 02 2020

Extensions

Offset corrected by Mohammed Yaseen, Jul 17 2023
New name from Hugo Pfoertner, Jul 19 2023

A378620 Lesser prime index of twin primes with nonsquarefree mean.

Original entry on oeis.org

2, 5, 7, 17, 20, 28, 35, 41, 43, 45, 49, 52, 57, 64, 69, 81, 83, 98, 109, 120, 140, 144, 152, 171, 173, 176, 178, 182, 190, 206, 215, 225, 230, 236, 253, 256, 262, 277, 286, 294, 296, 302, 307, 315, 318, 323, 336, 346, 373, 377, 390, 395, 405, 428, 430, 444
Offset: 1

Views

Author

Gus Wiseman, Dec 10 2024

Keywords

Comments

A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.
This is a subset of A029707 (twin prime indices). The other twin primes are A068361, so A029707 is the disjoint union of A068361 and A378620.

Crossrefs

The lesser of twin primes is A001359, index A029707 (complement A049579).
The greater of twin primes is A006512, index A107770 (complement appears to be A168543).
A subset of A029707 (twin prime lesser indices).
Prime indices of the primes listed by A061368.
Indices of twin primes with squarefree mean are A068361.
A000040 lists the primes, differences A001223, (run-lengths A333254, A373821).
A005117 lists the squarefree numbers, differences A076259.
A006562 finds balanced primes.
A013929 lists the nonsquarefree numbers, differences A078147.
A014574 is the intersection of A006093 and A008864.
A038664 finds the first position of a prime gap of 2n.
A046933 counts composite numbers between primes.
A120327 gives the least nonsquarefree number >= n.

Programs

  • Mathematica
    Select[Range[100],Prime[#]+2==Prime[#+1]&&!SquareFreeQ[Prime[#]+1]&]
    PrimePi/@Select[Partition[Prime[Range[500]],2,1],#[[2]]-#[[1]]==2&&!SquareFreeQ[Mean[#]]&][[;;,1]] (* Harvey P. Dale, Jul 13 2025 *)

Formula

prime(a(n)) = A061368(n).

A162153 Differences between the sum of consecutive composites and the prime that precedes them.

Original entry on oeis.org

1, 1, 20, 1, 32, 1, 44, 107, 1, 139, 80, 1, 92, 203, 227, 1, 259, 140, 1, 307, 164, 347, 562, 200, 1, 212, 1, 224, 1447, 260, 539, 1, 1157, 1, 619, 643, 332, 683, 707, 1, 1493, 1, 392, 1, 2056, 2176, 452, 1, 464, 947, 1, 1973, 1019, 1043, 1067, 1, 1099, 560, 1, 2309
Offset: 1

Views

Author

Claudio Meller, Jun 26 2009

Keywords

Examples

			a(1) = 4-3 = 1;
a(2) = 6-5 = 1;
a(3) = (8+9+10)-7 = 20;
a(4) = 12-11 = 1;
a(5) = (14+15+16)-13 = 32;
a(6) = 18-17 = 1;
a(7) = (20+21+22)-19 = 44;
a(8) = (24+25+26+27+28)-23 = 107; etc.
		

Crossrefs

Cf. A000040, A054265, A155752 (n for which a(n)=1).

Programs

  • Maple
    Primes:= select(isprime,[2,seq(i,i=3..1000,2)]):
    seq((Primes[i+1]^2-Primes[i+1]-Primes[i]^2-3*Primes[i])/2, i=2..nops(Primes)-1); # Robert Israel, Jul 18 2018

Formula

a(n) = A054265(n+1) - A000040(n+1). - R. J. Mathar, Jun 27 2009
a(n) = (prime(n+2)^2 - prime(n+1)^2 - prime(n+2) - 3*prime(n+1))/2. - Robert Israel, Jul 19 2018

Extensions

Edited and corrected by Robert Israel, Jul 18 2018
Showing 1-8 of 8 results.