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-10 of 14 results. Next

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

A028334 Differences between consecutive odd primes, divided by 2.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 3, 1, 3, 2, 1, 3, 2, 3, 4, 2, 1, 2, 1, 2, 7, 2, 3, 1, 5, 1, 3, 3, 2, 3, 3, 1, 5, 1, 2, 1, 6, 6, 2, 1, 2, 3, 1, 5, 3, 3, 3, 1, 3, 2, 1, 5, 7, 2, 1, 2, 7, 3, 5, 1, 2, 3, 4, 3, 3, 2, 3, 4, 2, 4, 5, 1, 5, 1, 3, 2, 3, 4, 2, 1, 2, 6, 4, 2, 4, 2, 3, 6, 1, 9, 3, 5, 3, 3, 1, 3
Offset: 2

Views

Author

Keywords

Comments

With an initial zero, gives the numbers of even numbers between two successive primes. - Giovanni Teofilatto, Nov 04 2005
Equal to difference between terms in A067076. - Eric Desbiaux, Aug 07 2010
The twin prime conjecture is that a(n) = 1 infinitely often. Yitang Zhang has proved that a(n) < 3.5 x 10^7 infinitely often. - Jonathan Sondow, May 17 2013
a(n) = 1 if, and only if, n + 1 is in A107770. - Jason Kimberley, Nov 13 2015

Examples

			23 - 19 = 4, so a(8) = 4/2 = 2.
29 - 23 = 6, so a(9) = 6/2 = 3.
31 - 29 = 2, so a(10) = 2/2 = 1.
		

References

  • Milton Abramowitz and Irene A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 870.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

Crossrefs

Cf. A005521.
Cf. A000230 (least prime with a gap of 2n to the next prime).
Sequences related to the differences between successive primes: A001223 (Delta(p)), A028334, A080378, A104120, A330556 - A330561.

Programs

Formula

a(n) = A001223(n)/2 for n > 1.
a(n) = (prime(n+1) - prime(n)) / 2, where prime(n) is the n-th prime.
a(n) = A047160(A024675(n-1)). - Jason Kimberley, Nov 12 2015
G.f.: (b(x)/((x + 1)/((1 - x)) - 1) - 1 - x/2)/x, where b(x) is the g.f. of A000040. - Mario C. Enriquez, Dec 10 2016

Extensions

Replaced multiplication by division in the cross-reference R. J. Mathar, Jan 23 2010
Definition corrected by Jonathan Sondow, May 17 2013
Edited by Franklin T. Adams-Watters, Aug 07 2014

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

A120875 Product of twin primes minus 1.

Original entry on oeis.org

14, 34, 142, 322, 898, 1762, 3598, 5182, 10402, 11662, 19042, 22498, 32398, 36862, 39202, 51982, 57598, 72898, 79522, 97342, 121102, 176398, 186622, 213442, 272482, 324898, 359998, 381922, 412162, 435598, 656098, 675682, 685582, 736162
Offset: 1

Views

Author

Lekraj Beedassy, Jul 09 2006

Keywords

Comments

This sequence is a subsequence of A023515.

Crossrefs

Programs

  • Mathematica
    Times[#, # + 2] - 1 & /@ Select[Prime@ Range@ 150, PrimeQ[# + 2] &] (* Michael De Vlieger, Oct 23 2015 *)
  • PARI
    for(n=1, 200, if(prime(n+1)-prime(n)==2, print1(prime(n)*prime(n+1)-1", "))) \\ Altug Alkan, Oct 23 2015

Formula

a(n) = A037074(n)-1 = (A014574(n))^2 -2 = A075369(n)-2.
a(n) = 2*A120876(n). - Jason Kimberley, Oct 23 2015
a(n) = 36*A002822(n-1)^2-2, for n>1. - Jason Kimberley, Oct 23 2015
a(n) = A023515(A107770(n)). - Jason Kimberley, Oct 23 2015

A120876 (Product of twin primes - 1)/2.

Original entry on oeis.org

7, 17, 71, 161, 449, 881, 1799, 2591, 5201, 5831, 9521, 11249, 16199, 18431, 19601, 25991, 28799, 36449, 39761, 48671, 60551, 88199, 93311, 106721, 136241, 162449, 179999, 190961, 206081, 217799, 328049, 337841, 342791, 368081, 388961, 520199, 532511, 551249, 563921
Offset: 1

Views

Author

Lekraj Beedassy, Jul 09 2006

Keywords

Comments

This sequence is a subsequence of A102770.

Crossrefs

Cf. The subsequence A086870.

Programs

  • Mathematica
    (Times@@#-1)/2&/@Select[Partition[Prime[Range[200]], 2,1],Last[#]- First[#]== 2&] (* Harvey P. Dale, Jun 26 2011 *)
  • PARI
    for(n=1, 200, if(prime(n+1)-prime(n)==2, print1((prime(n)*prime(n+1)-1)/2", "))) \\ Altug Alkan, Oct 23 2015
    
  • PARI
    p=2; forprime(q=3, 1e3, if(q-p==2, print1(p*q\2", ")); p=q) \\ Charles R Greathouse IV, Apr 01 2016

Formula

a(n) = A120875(n)/2 = A075369(n)/2-1 = A075369(n)^2/2-1.
a(n) = 18*A002822(n-1)^2-1, for n>1.
a(n) = A102770(A107770(n)). - Jason Kimberley, Nov 10 2015

Extensions

Corrected by T. D. Noe, Oct 25 2006
Edited by Jason Kimberley, Oct 23 2015

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

A333201 Rectangular array read by antidiagonals: row n shows the numbers k such that p(k) = prime(k-1) + 2n, where prime(k) = k-th prime, with 1 prefixed to row 1.

Original entry on oeis.org

1, 2, 5, 3, 7, 10, 4, 9, 12, 25, 6, 13, 16, 73, 35, 8, 15, 17, 78, 43, 47, 11, 20, 19, 80, 54, 48, 31, 14, 23, 22, 88, 62, 92, 63, 283, 18, 26, 24, 93, 69, 98, 67, 296, 100, 21, 28, 33, 95, 81, 115, 138, 320, 181, 155, 27, 30, 37, 125, 83, 122, 147, 332, 206
Offset: 1

Views

Author

Clark Kimberling, May 11 2020

Keywords

Comments

Every positive integer occurs exactly once, so that as a sequence, this is a permutation of the positive integers. Row 1: A107770, except for initial 1,2.

Examples

			Northwest corner:
    1      2     3     4     6    8    11   14   18   21
    5      7     9    13    15   20    23   26   28   30
   10     12    16    17    19   22    24   33   37   38
   25     73    78    80    88   93    95  125  127  129
   35     43    54    62    69   81    83  102  107  116
		

Crossrefs

Programs

  • Mathematica
    z = 2700; p = Prime[Range[z]];
    r[n_] := Select[Range[z], p[[#]] - p[[# - 1]] == 2 n &]; r[1] = Join[{1, 2}, r[1]];
    TableForm[Table[Prime[r[n]], {n, 1, 18}]]  (* A333200, array *)
    TableForm[Table[r[n], {n, 1, 18}]] (* A333201, array *)
    Table[Prime[r[n - k + 1][[k]]], {n, 12}, {k, n, 1, -1}] // Flatten (* A333200, sequence *)
    Table[r[n - k + 1][[k]], {n, 12}, {k, n, 1, -1}] // Flatten (* A333201, sequence *)

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

A334142 Indices of twin primes.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 14, 17, 18, 20, 21, 26, 27, 28, 29, 33, 34, 35, 36, 41, 42, 43, 44, 45, 46, 49, 50, 52, 53, 57, 58, 60, 61, 64, 65, 69, 70, 81, 82, 83, 84, 89, 90, 98, 99, 104, 105, 109, 110, 113, 114, 116, 117, 120, 121, 140, 141, 142, 143, 144, 145, 148, 149
Offset: 1

Views

Author

Ilya Gutkovskiy, Apr 15 2020

Keywords

Crossrefs

Programs

  • Maple
    q:= n-> (p-> isprime(p-2) or isprime(p+2))(ithprime(n)):
    select(q, [$1..150])[];  # Alois P. Heinz, Apr 15 2020
  • Mathematica
    With[{p = PositionIndex[(#[[2]] - #[[1]] - 2) & /@ Partition[Prime[Range[150]], 2, 1]][0]}, Union[p, p + 1]] (* Amiram Eldar, Sep 06 2024 *)

Formula

a(n) = A000720(A001097(n)).
Set union of A029707 and A107770.
Showing 1-10 of 14 results. Next