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.

Previous Showing 11-20 of 108 results. Next

A038664 a(n)-th and (a(n)+1)-st primes are the first pair of primes that differ by exactly 2n; a(n) = -1 if no such pair of primes exists.

Original entry on oeis.org

2, 4, 9, 24, 34, 46, 30, 282, 99, 154, 189, 263, 367, 429, 590, 738, 217, 1183, 3302, 2191, 1879, 1831, 7970, 3077, 3427, 2225, 3793, 8028, 4612, 4522, 3644, 8688, 14862, 12542, 15783, 3385, 34202, 19026, 17006, 44773, 23283, 38590, 14357
Offset: 1

Views

Author

Keywords

Comments

Does anyone know of a proof that a(n) is defined for all natural numbers n, i.e., f:n -> prime(n+1)-prime(n) is a surjective map from N-{1} -> E, where N, E are the sets of natural numbers and even numbers, respectively? - Joseph L. Pe, Dec 14 2002
a(n) is defined for all n if (but not only if) de Polignac's conjecture is true. - Harry J. Smith, Jul 22 2003

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a038664 = (+ 1) . fromJust . (`elemIndex` a001223_list) . (* 2)
    -- Reinhard Zumkeller, Aug 23 2015
  • Mathematica
    Table[k = 0; While[k++; p1 = Prime[k]; p2 = Prime[k + 1]; (p2 - p1) != n]; k, {n, 2, 200, 2}] (* Lei Zhou, Mar 01 2005 *)
    With[{d=Differences[Prime[Range[50000]]]},Flatten[Table[Position[d,2n,1,1],{n,50}]]] (* This program is many times faster than the first Mathematica program above. *) (* Harvey P. Dale, Nov 24 2012 *)
  • PARI
    first(m)=my(v=vector(m),n);for(n=1,m,v[n]=0;until(2*n==prime(v[n]+1)-prime(v[n]),v[n]++)); v; \\ Anders Hellström, Jul 19 2015
    

Formula

a(n) = A000720(A000230(n)). - M. F. Hasler, Jan 16 2011
A001223(a(n)) = 2*n and A001223(m) != 2*n for m < a(n). - Reinhard Zumkeller, Aug 23 2015

Extensions

More terms from Michel ten Voorde, Apr 13 2001
"a(n) = -1 if ..." added to definition at the suggestion of Alexander Wajnberg by N. J. A. Sloane, Feb 02 2020

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

A073051 Least k such that Sum_{i=1..k} (prime(i) + prime(i+2) - 2*prime(i+1)) = 2n + 1.

Original entry on oeis.org

1, 3, 8, 23, 33, 45, 29, 281, 98, 153, 188, 262, 366, 428, 589, 737, 216, 1182, 3301, 2190, 1878, 1830, 7969, 3076, 3426, 2224, 3792, 8027, 4611, 4521, 3643, 8687, 14861, 12541, 15782, 3384, 34201, 19025, 17005, 44772, 23282, 38589, 14356
Offset: 1

Views

Author

Robert G. Wilson v, Aug 15 2002

Keywords

Comments

Also, least k such that 2n = A001223(k-1) = prime(k+1) - prime(k), where prime(k) = A001223(n). - Alexander Adamchuk, Jul 30 2006
Also the least number k>0 such that the k-th maximal run of composite numbers has length 2n-1. For example, the 8th such run (24,25,26,27,28) is the first of length 2(3)-1, so a(3) = 8. Also positions of first appearances in A176246 (A046933 without first term). - Gus Wiseman, Jun 12 2024

Examples

			a(3) = 8 because 1+0+2-2+2-2+2+2 = 5 and (5+1)/2 = 3.
		

Crossrefs

Position of first appearance of 2n+1 in A176246.
For nonsquarefree runs we have a bisection of A373199.
A000040 lists the primes, first differences A001223.
A002808 lists the composite numbers, differences A073783, sums A053767.
A046933 counts composite numbers between primes.
A065855 counts composite numbers up to n.

Programs

  • Mathematica
    NextPrim[n_Integer] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; a = Table[0, {50}]; s = 0; k = 1; p = 0; q = 2; r = 3; While[k < 10^6, p = q; q = r; r = NextPrim[q]; s = s + p + r - 2q; If[s < 101 && a[[(s + 1)/2]] == 0, a[[(s + 1)/2]] = k]; k++ ]; a
  • PARI
    a001223(n) = prime(n+1) - prime(n);
    a(n) = {my(k = 1); while(2*n != A001223(k+1), k++); k;} \\ Michel Marcus, Nov 20 2016

Formula

a(n) = A038664(n) - 1. - Filip Zaludek, Nov 19 2016

A131109 a(n) is the smallest semiprime such that difference between a(n) and next semiprime, b(n), is n.

Original entry on oeis.org

9, 4, 6, 10, 69, 15, 26, 169, 146, 237, 95, 1082, 818, 597, 1603, 2705, 2078, 4511, 1418, 2681, 14545, 13863, 37551, 6559, 16053, 55805, 26707, 17965, 308918, 32777, 41222, 35103, 393565, 219509, 153263, 87627, 2263057, 35981, 1789339, 741841, 797542
Offset: 1

Views

Author

Zak Seidov, Sep 24 2007

Keywords

Comments

This is the semiprime analogous to A000230. - Robert G. Wilson v, Jun 13 2013

Examples

			n, b(n)-a(n): 1=10-9, 2=6-4, 3=9-6, 4=14-10, 5=74-69, 6=21-15, 7=33-26, 8=177-169, 9=155-146, 10=247-237, 11=106-95, 12=1094-1082, 13=831-818, 14=611-597, 15=1618-1603, 16=2721-2705, 17=2095-2078, 18=4529-4511, 19=1437-1418, 20=2701-2681, 21=14566-14545, 22=13885-13863, 23=37574-37551, 24=6583-6559, 25=16078-16053, 26=55831-55805, 27=26734-26707, 28=17993-17965, 29=308947-308918, 30=32807-32777, 31=41253-41222, 32=35135-35103, 33=393598-393565, 34=219543-219509, 35=153298-153263, 36=87663-87627, 37=2263094-2263057, 38=36019-35981.
		

Crossrefs

Programs

  • Mathematica
    SemiPrimeQ[n_Integer] := If[Abs[n] < 2, False, (2 == Plus @@ Transpose[FactorInteger[Abs[n]]][[2]])]; NextSemiPrime[n_] := Module[{m = n + 1}, While[! SemiPrimeQ[m], m++]; m]; nn = 30; t = Table[0, {nn}]; found = 0; sp0 = 4; While[found < nn, sp1 = NextSemiPrime[sp0]; d = sp1 - sp0; If[d <= nn && t[[d]] == 0, t[[d]] = sp0; found++]; sp0 = sp1]; t (* T. D. Noe, Oct 02 2012 *)

Formula

a(n) = A001358(A123375(n)). - T. D. Noe, Sep 28 2007

Extensions

Corrected and extended by T. D. Noe and R. J. Mathar, Sep 28 2007

A001632 Smallest prime p such that there is a gap of 2n between p and previous prime.

Original entry on oeis.org

5, 11, 29, 97, 149, 211, 127, 1847, 541, 907, 1151, 1693, 2503, 2999, 4327, 5623, 1361, 9587, 30631, 19373, 16183, 15727, 81509, 28277, 31957, 19661, 35671, 82129, 44351, 43391, 34123, 89753, 162209, 134581, 173429, 31469, 404671, 212777
Offset: 1

Views

Author

Keywords

Comments

Smallest prime preceded by 2n-1 successive composites. - Lekraj Beedassy, Apr 23 2010

Examples

			The first time a gap of 4 occurs between primes is between 7 and 11, so A000230(2)=7 and A001632(2)=11.
		

References

  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 97, p. 34, Ellipses, Paris 2008.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    With[{pr=Partition[Prime[Range[35000]],2,1]},Transpose[ Flatten[ Table[ Select[pr,#[[2]]-#[[1]]==2n&,1],{n,40}],1]][[2]]] (* Harvey P. Dale, Apr 20 2012 *)
  • PARI
    LIMIT=10^9; a=[]; i=2; o=2; g=0; forprime(p=3,LIMIT, bittest(g,-o+o=p) && next; a=concat(a,[[p,p-precprime(p-1)]]); g+=1<=i && a[i][2]<2*i, print1(a[i][1]",");i++)) \\ a[1] = [3, 1] is not printed, cf. A000230(0). Limit 10^7 yields a(1),...,a(70) in 0.3 sec @ 2.5 GHz. \\ M. F. Hasler, Jan 13 2011, updated Jan 26 2015.

Formula

a(n) = 2n + A000230(n) = nextprime(A000230(n)).
a(n) = A000040(A038664(n)+1). - M. F. Hasler, Jan 26 2015

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 28 2000 and from Labos Elemer, Nov 29 2000
Terms a(1)-a(146) checked with the PARI program by M. F. Hasler, Jan 13 2011, Jan 26 2015

A138198 First occurrence of prime gaps which are squares.

Original entry on oeis.org

2, 7, 1831, 9551, 89689, 396733, 11981443, 70396393, 1872851947, 10958687879, 47203303159, 767644374817, 8817792098461, 78610833115261, 497687231721157, 2069461000669981, 22790428875364879, 78944802602538877, 1799235198379903447, 30789586795090405813
Offset: 0

Views

Author

Zak Seidov, Mar 05 2008

Keywords

Comments

More precisely, consider the possible squares which can occur as prime gaps: g_0=1, g_1=2^2, g_2=4^2, g_3=6^2, g_4=8^2, ... Then a(n) = smallest prime p(i) such that p(i+1)-p(i) = g_n, or a(n) = -1 if the gap g_n never occurs. - N. J. A. Sloane, Oct 28 2016

Examples

			Notes by Thomas R. Nicely:
No gap exceeding 1442 has been definitively established as a first occurrence; larger gaps included in these lists are instead first occurrences presently known of prime gaps. The smallest gap whose first occurrence remains uncertain is the (nonsquare) gap of 1208.
prime,gap
2, 1=1^2
7, 4=2^2
1831, 16=4^2
9551, 36=6^2
89689, 64=8^2
396733, 100=10^2
11981443, 144=12^2
70396393, 196=14^2
1872851947, 256=16^2
10958687879, 324=18^2
47203303159, 400=20^2
767644374817, 484=22^2
8817792098461, 576=24^2
78610833115261, 676=26^2
497687231721157, 784=28^2
2069461000669981, 900=30^2
22790428875364879, 1024=32^2
78944802602538877, 1156=34^2
2980374211158121907, 1296=36^2
18479982848279580912452968237, 1444=38^2
10338270318362067887873513954823823, 1600=40^2
5462539353768233509094313080601639583, 1764=42^2
9634432076725832064810529394509018411, 1936=44^2
24103660699017475735076387748469761375352177, 2116=46^2
1171872038536282864481405693168029955108099, (*48^2*)
169512938487733553802932479078305855585466971701227, (*50^2*)
228422210024736896126707605155690522381875250546666532046327, (*52^2*)
7229972437439469171089374324333535009566526827968927563, (*54^2*)
1263895714932859021916447978075625934206362807439043695674222113, (*56^2*)
569493611436727594340298806603382857255173440636060754222617328828425379, (*58^2*)
281376087412013738611508677824321032930454474305215907812114263492815921, (*60^2*)
680561565394793619717614472954048053005171290126070180152868857556290989645629867 (*62^2*)
		

Programs

  • Mathematica
    Function[w, Prime@ First@ # & /@ Map[w[[ Key@ # ]] &, Select[Keys@ w, IntegerQ@ Sqrt@ # &]]]@ PositionIndex@ Differences@ Prime@ Range[10^7] (* Michael De Vlieger, Oct 27 2016 *)
  • PARI
    a(n)=my(k=max(1,4*(n-1)^2),p=2);forprime(q=3,,if(q-p==k,return(p));p=q) \\ Charles R Greathouse IV, Jun 05 2013

Formula

a(n) = A000230(2*n^2). - R. J. Mathar, Feb 13 2025

Extensions

Edited by N. J. A. Sloane, Oct 28 2016
Misprints in EXAMPLE fixed by Zak Seidov, Oct 18 2018
a(18)-a(19) from Brian Kehrig, May 02 2025

A226657 Smallest of the first four consecutive primes that comprise two sets of primes with difference 2*n.

Original entry on oeis.org

5, 7, 23, 389, 409, 1511, 5309, 3373, 7351, 37223, 19867, 18593, 142811, 14563, 13933, 763271, 276637, 174491, 363989, 383179, 180907, 687179, 8066923, 913589, 458069, 6358777, 2507093, 5650871, 9182389, 5256071, 10237391, 9955009, 4091393, 24374033
Offset: 1

Views

Author

Arkadiusz Wesolowski, Jun 14 2013

Keywords

Comments

An equivalent definition of this sequence: smallest prime which gives a cluster of primes with the spacing pattern 2*n; x; 2*n, x > 0.
A229021 gives the record values. - Arkadiusz Wesolowski, Sep 11 2013

Examples

			Difference two - primes: 5, 7, 11, 13.
Difference four - primes: 7, 11, 13, 17.
Difference six - primes: 23, 29, 31, 37.
		

Crossrefs

Programs

  • Mathematica
    lst = {}; Do[a = 3; While[True, b = NextPrime[a]; If[b - a == n && NextPrime[b, 2] - NextPrime[b] == n, AppendTo[lst, a]; Break[]]; a = b], {n, 2, 68, 2}]; lst
    Table[SelectFirst[Partition[Prime[Range[16*10^5]],4,1],AllTrue[{#[[2]]-#[[1]],#[[4]]- #[[3]]}, EvenQ]&&#[[2]]-#[[1]]==#[[4]]-#[[3]]==2n&],{n,35}][[All,1]] (* Harvey P. Dale, Jun 07 2022 *)

A348514 Numbers k for which A003961(k) = 2k+1, where A003961 shifts the prime factorization of n one step towards larger primes.

Original entry on oeis.org

4, 10, 57, 1054, 2626, 68727, 12371554, 1673018314, 10475647197, 11154517557, 27594844918, 630178495917, 7239182861878
Offset: 1

Views

Author

Antti Karttunen, Oct 29 2021

Keywords

Comments

Numbers k such that A064216(1+k) = k.
It seems that after 4, all other terms are squarefree. See conjecture in A348511.
a(9)..a(13) <= 10475647197, 11154517557, 27594844918, 630178495917, 7239182861878, which are also terms. - David A. Corneth, Oct 30 2021

Crossrefs

Fixed points of map A108228. (Compare to A048674).
Positions of ones in A252748.
Subsequence of the following sequences: A246282, A319630, A348511, A378980 (see also A379216), A387411, A387414.

Programs

  • Mathematica
    f[p_, e_] := NextPrime[p]^e; s[1] = 1; s[n_] := Times @@ f @@@ FactorInteger[n]; Select[Range[10^5], s[#] == 2*# + 1 &] (* Amiram Eldar, Oct 30 2021 *)

Extensions

a(9)-a(11) verified by Amiram Eldar, Nov 01 2021
a(12)-a(13) verified by Martin Ehrenstein, Nov 08 2021

A045881 Smallest of first string of exactly 2n-1 consecutive composite integers.

Original entry on oeis.org

4, 8, 24, 90, 140, 200, 114, 1832, 524, 888, 1130, 1670, 2478, 2972, 4298, 5592, 1328, 9552, 30594, 19334, 16142, 15684, 81464, 28230, 31908, 19610, 35618, 82074, 44294, 43332, 34062, 89690, 162144, 134514, 173360, 31398, 404598, 212702, 188030, 542604
Offset: 1

Views

Author

Keywords

Crossrefs

Equals A000230(n) + 1.

Programs

  • Mathematica
    Reap[For[k=2, k <= 80, k = k+2, p=3; q=5; While[q-p != k, p=q; q=NextPrime[p+1]]; Print[p+1]; Sow[p+1]]][[2, 1]] (* Jean-François Alcover, May 17 2013, after Klaus Brockhaus *)
    With[{cmps=Table[If[CompositeQ[n],1,0],{n,10^6}]},Flatten[Table[ SequencePosition[ cmps,Join[{0},PadRight[{},i,1],{0}],1],{i,1,81,2}],1][[All,1]]+1] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 02 2017 *)
  • PARI
    forstep(k=2,80,2,p=3;q=5;while(q-p!=k,p=q;q=nextprime(p+1));print1(p+1,",")) \\ Klaus Brockhaus, Jan 24 2008

Extensions

More terms from Harvey P. Dale, Jul 27 2001

A098974 Primes p such that q-p = 24, where q is the next prime after p.

Original entry on oeis.org

1669, 2179, 4177, 4523, 4759, 5237, 6173, 6397, 6737, 7079, 7369, 7793, 8123, 8329, 9067, 11003, 11633, 11839, 12073, 12119, 13009, 13267, 16033, 16193, 16453, 16763, 16787, 17053, 17683, 17989, 18593, 18637, 19183, 19507, 20483, 22409, 22877, 23227
Offset: 1

Views

Author

Douglas Winston (douglas.winston(AT)srupc.com), Oct 23 2004

Keywords

Comments

Lower prime of a difference of 24 between consecutive primes.
23 successive numbers after prime number p are composite. - Artur Jasinski, Jan 15 2007

Crossrefs

Programs

  • Mathematica
    a = {}; Do[If[Prime[x + 1] - Prime[x] == 24, AppendTo[a, Prime[x]]], {x, 1, 10000}]; a (* Artur Jasinski, Jan 15 2007 *)

Extensions

Entry revised by N. J. A. Sloane, Feb 13 2007
Previous Showing 11-20 of 108 results. Next