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 18 results. Next

A155765 Where records occur in A047160.

Original entry on oeis.org

2, 4, 8, 22, 46, 121, 128, 136, 146, 238, 265, 286, 341, 344, 526, 904, 1114, 1691, 1736, 1751, 1781, 2476, 3097, 3551, 5131, 8504, 10342, 18526, 22564, 24776, 40072, 68707, 125903, 174913, 181267, 371428, 827576, 936118, 1054141, 1159864, 1353559
Offset: 1

Views

Author

T. D. Noe, Jan 27 2009

Keywords

Comments

It appears that no term is a multiple of three. Equivalently, assuming a(n) - A155764(n) =/= 3, every term of A155764 is a multiple of three. Jason Kimberley, Oct 20 2012

Crossrefs

Cf. A155764 (the record values).

A155764 Records in A047160.

Original entry on oeis.org

0, 1, 3, 9, 15, 18, 21, 27, 33, 39, 42, 45, 48, 75, 87, 93, 117, 120, 135, 138, 168, 183, 210, 228, 300, 333, 369, 393, 453, 525, 621, 720, 810, 846, 1086, 1281, 1305, 1515, 1590, 1617, 1722, 1794, 1833, 1851, 2010, 2064, 2085, 2112, 2217, 2352, 2754, 2784
Offset: 1

Views

Author

T. D. Noe, Jan 27 2009

Keywords

Comments

Other than a(2)=1, every known term is a multiple of three. Equivalently, assuming A155765(n) - a(n) != 3, no term of A155765 is a multiple of three. - Jason Kimberley, Oct 24 2012
Conjecture 1: a(n) < 0.138*log(A155765(n))^3.6 for n > 4. Conjecture 2: If Conjecture 1 and Goldbach's conjecture hold, for any integer m > 22, there exist at least one pairs of primes m-d and m+d such that d < 0.138*log(m)^3.6. - Ya-Ping Lu, Nov 27 2020

Crossrefs

Cf. A155765 (where records occur in A047160).

Programs

  • Mathematica
    mgppp[n_?EvenQ]/;n>3:=Block[{m=PrimePi[n/2],p},While[!PrimeQ[n-(p=Prime[m])],m--];p];
    dist[n_?EvenQ]:=Module[{d},{m=n/2,d=(m-mgppp[n])};d]
    For[n=4;a=-1,True,n+=2,b=dist[n];If[b>a,Print[b];a=b]]
    (* Gilmar Rodriguez Pierluissi, Aug 27 2018 *)
  • Python
    from sympy import isprime
    a_rec = -1
    m = 2
    while 1:
        a = 0
        while a < m - 1:
            if isprime(m-a) == 1 and isprime(m+a) == 1:
                if a > a_rec:
                    print(a)
                    a_rec = a
                break
            a += 1
    m += 1 # Ya-Ping Lu, Nov 27 2020

Formula

a(n) = A047160(A155765(n)). - Jason Kimberley, Sep 01 2011

A210700 A047160(3n): smallest m >= 0 with both 3n - m and 3n + m prime.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 5, 4, 1, 4, 5, 2, 1, 2, 5, 8, 7, 4, 1, 4, 5, 2, 1, 4, 5, 2, 5, 14, 7, 4, 7, 2, 1, 2, 1, 2, 13, 10, 7, 14, 13, 2, 5, 4, 1, 10, 5, 10, 1, 4, 7, 8, 5, 2, 5, 8, 7, 4, 1, 10, 5, 8, 1, 2, 1, 10, 7, 16, 13, 14, 17, 8, 11, 2, 1, 2, 5, 4, 1, 14, 5
Offset: 1

Views

Author

Jason Kimberley, Oct 15 2012

Keywords

Comments

This sequence is interesting because, apart from a(2)=1, A155764 appears to consist only of multiples of three. Equivalently, since n and A047160(n) are coprime (for nonzero A047160(n)), no multiple of three appears to occur in A155765.

Crossrefs

Cf. A210701 (location of records in this sequence), A210702 (records in this sequence).

Programs

  • Mathematica
    sml[n_]:=Module[{m=0},While[!PrimeQ[3n-m]||!PrimeQ[3n+m],m++];m]; Array[ sml,100] (* Harvey P. Dale, Sep 23 2022 *)

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

A082467 Least k>0 such that n-k and n+k are both primes.

Original entry on oeis.org

1, 2, 1, 4, 3, 2, 3, 6, 1, 6, 3, 2, 3, 6, 1, 12, 3, 2, 9, 6, 5, 6, 3, 4, 9, 12, 1, 12, 9, 4, 3, 6, 5, 6, 9, 2, 3, 12, 1, 24, 3, 2, 15, 6, 5, 12, 3, 8, 9, 6, 7, 12, 3, 4, 15, 12, 1, 18, 9, 4, 3, 6, 5, 6, 15, 2, 3, 12, 1, 6, 15, 4, 3, 6, 5, 18, 9, 2, 15, 24, 5, 12, 3, 14, 9, 18, 7, 12, 9, 4, 15, 6, 7, 30, 9
Offset: 4

Views

Author

Benoit Cloitre, Apr 27 2003

Keywords

Comments

The existence of k>0 for all n >= 4 is equivalent to the strong Goldbach Conjecture that every even number >= 8 is the sum of two distinct primes.
n and k are coprime, because otherwise n + k would be composite. So the rational sequence r(n) = a(n)/n = k/n is injective. - Jason Kimberley, Sep 21 2011
Because there are arbitrarily many composites from m!+2 to m!+m, there are also arbitrarily large a(n) but they increase very slowly. The twin prime conjecture implies that infinitely many a(n) are 1. - Juhani Heino, Apr 09 2020

Examples

			n=10: k=3 because 10-3 and 10+3 are both prime and 3 is the smallest k such that n +/- k are both prime.
		

Crossrefs

Cf. A129301 (records), A129302 (where records occur).
Cf. A047160 (allows k=0).
Cf. A078611 (subset for prime n).

Programs

  • Magma
    A082467 := func; [A082467(n):n in [4..98]]; // Jason Kimberley, Sep 03 2011
  • Maple
    A082467 := proc(n) local k; k := 1+irem(n,2);
    while n > k do if isprime(n-k) then if isprime(n+k)
    then RETURN(k) fi fi; k := k+2 od; print("Goldbach erred!") end:
    seq(A082467(i),i=4..90); # Peter Luschny, Sep 21 2011
  • Mathematica
    f[n_] := Block[{k}, If[OddQ[n], k = 2, k = 1]; While[ !PrimeQ[n - k] || !PrimeQ[n + k], k += 2]; k]; Table[ f[n], {n, 4, 98}] (* Robert G. Wilson v, Mar 28 2005 *)
  • PARI
    a(n)=if(n<0,0,k=1; while(isprime(n-k)*isprime(n+k) == 0,k++); k)
    

Formula

A078496(n)-a(n) = A078587(n)+a(n) = n.

Extensions

Entries checked by Klaus Brockhaus, Apr 08 2007

A078611 Radius of the shortest interval (of positive length) centered at prime(n) that has prime endpoints.

Original entry on oeis.org

2, 4, 6, 6, 6, 12, 6, 12, 12, 6, 12, 24, 6, 6, 12, 18, 6, 12, 6, 18, 24, 18, 30, 12, 6, 6, 30, 24, 24, 18, 30, 12, 18, 12, 6, 36, 30, 6, 12, 18, 42, 30, 30, 42, 12, 60, 30, 48, 6, 12, 30, 12, 6, 6, 12, 42, 6, 12, 54, 24, 24, 42, 36, 36, 18, 30, 36, 18, 6, 42, 30, 6, 30, 36, 30, 24, 18, 12
Offset: 3

Views

Author

Joseph L. Pe, Dec 09 2002

Keywords

Comments

a(1) and a(2) are undefined. Alternatively, a(n) = least k, 1 < k < n, such that prime(n) + k and prime(n) - k are both prime. I conjecture that a(n) is defined for all n > 2. Equivalently, every prime > 3 is the average of two distinct primes.
a(n) embodies the difference between weak and strong Goldbach conjectures, and therefore between A047160 and A082467 which differ only for prime arguments (a(n)=A082467(prime(n)), while A047160(prime(n))=0). - Stanislav Sykora, Mar 14 2014

Examples

			prime(3) = 5 is the center of the interval [3,7] that has prime endpoints; this interval has radius = 7-5 = 2. Hence a(3) = 2. prime(5) = 11 is the center of the interval [5,17] that has prime endpoints; this interval has radius = 17-11 = 6. Hence a(5) = 6.
		

Crossrefs

Cf. A047160, A082467. - Stanislav Sykora, Mar 14 2014

Programs

  • Mathematica
    f[n_] := Module[{p, k}, p = Prime[n]; k = 1; While[(k < p) && (! PrimeQ[p - k] || ! PrimeQ[p + k]), k = k + 1]; k]; Table[f[i], {i, 3, 103}]
  • PARI
    StrongGoldbachForPrimes(nmax)= {local(v,i,p,k);v=vector(nmax); for (i=1,nmax,p=prime(i);v[i] = -1; for (k=1,p-2,if (isprime(p-k)&&isprime(p+k),v[i]=k;break;););); return (v);} \\ Stanislav Sykora, Mar 14 2014

Formula

a(n) = A082467(A000040(n)). - Jason Kimberley, Jun 25 2012

A002374 Largest prime <= n in any decomposition of 2n into a sum of two odd primes.

Original entry on oeis.org

3, 3, 5, 5, 7, 5, 7, 7, 11, 11, 13, 11, 13, 13, 17, 17, 19, 17, 19, 13, 23, 19, 19, 23, 23, 19, 29, 29, 31, 23, 29, 31, 29, 31, 37, 29, 37, 37, 41, 41, 43, 41, 43, 31, 47, 43, 37, 47, 43, 43, 53, 47, 43, 53, 53, 43, 59, 59, 61, 53, 59, 61, 59, 61, 67, 53, 67, 67, 71, 71, 73, 59
Offset: 3

Views

Author

Keywords

Comments

Sequence A112823 is identical except that it is very naturally extended to a(2) = 2, i.e., the word "odd" is dropped from the definition. - M. F. Hasler, May 03 2019

References

  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 80.
  • N. Pipping, Neue Tafeln für das Goldbachsche Gesetz nebst Berichtigungen zu den Haussnerschen Tafeln, Finska Vetenskaps-Societeten, Comment. Physico Math. 4 (No. 4, 1927), pp. 1-27.
  • 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

Essentially the same as A112823. - Franklin T. Adams-Watters, Jan 25 2010

Programs

  • Mathematica
    nmax = 74; a[n_] := (k = 0; While[k < n && (!PrimeQ[n-k] || !PrimeQ[n+k]), k++]; If[k == n, n+1, n-k]); Table[a[n], {n, 3, nmax}](* Jean-François Alcover, Nov 14 2011, after Jason Kimberley *)
    lp2n[n_]:=Max[Select[Flatten[Select[IntegerPartitions[2n,{2}],AllTrue[ #, PrimeQ]&]],#<=n&]]; Array[lp2n,80,2] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jun 08 2018 *)
  • PARI
    a(n)=forstep(k=n,1,-1, if(isprime(k) && isprime(2*n-k), return(k))) \\ Charles R Greathouse IV, Feb 07 2017
    
  • PARI
    A002374(n)=forprime(q=n, 2*n, isprime(2*n-q)&&return(2*n-q)) \\ M. F. Hasler, May 03 2019

Formula

a(n) = n - A047160(n) = A112823(n) (for n >= 3). - Jason Kimberley, Aug 31 2011

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 21 2000

A112823 Greatest p less than or equal to n with p and q both prime, p+q = 2n.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 5, 7, 7, 11, 11, 13, 11, 13, 13, 17, 17, 19, 17, 19, 13, 23, 19, 19, 23, 23, 19, 29, 29, 31, 23, 29, 31, 29, 31, 37, 29, 37, 37, 41, 41, 43, 41, 43, 31, 47, 43, 37, 47, 43, 43, 53, 47, 43, 53, 53, 43, 59, 59, 61, 53, 59, 61, 59, 61, 67, 53, 67, 67, 71, 71, 73
Offset: 2

Views

Author

Robert G. Wilson v, Sep 05 2005

Keywords

Comments

Essentially the same as A002374, which is the main entry for this sequence. - Franklin T. Adams-Watters, Jan 25 2010
Well defined only under the assumption that the yet unproved Goldbach conjecture holds, which states that any even N = 2n > 2 has a decomposition as sum of two primes. - M. F. Hasler, May 03 2019

Examples

			From _M. F. Hasler_, May 03 2019: (Start)
For n = 2, the largest prime p <= n is p = 2, and q := 2n - p = 4 - 2 = 2 is also prime, whence a(2) = 2. We see that whenever n is prime, we will have a(n) = p = q = n.
For n = 4, the largest prime p <= n is p = 3, and q := 2n - p = 8 - 3 = 5 is also prime, whence a(4) = p = 3.
For n = 8, the largest prime less than n is p' = 7, but 2n - p' = 16 - 7 = 9 is not prime, so we have to go to the next smaller prime p = 5 and now q := 2n - p = 16 - 5 = 11 is also prime, whence a(8) = p = 5. (End)
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = n/2}, While[ !PrimeQ[p] || !PrimeQ[n - p], p-- ]; p]; Table[ f[n], {n, 4, 146, 2}]
  • PARI
    a(n) = {my(p = precprime(n)); while (!isprime(2*n-p), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 22 2016
    
  • PARI
    A112823(n)=forprime(q=n,2*n,isprime(2*n-q)&&return(2*n-q)) \\ M. F. Hasler, May 03 2019

Formula

a(n) = n - A047160(n). - Jason Kimberley, Aug 31 2011
a(n) = n if and only if n is prime, i.e., n in A000040. - M. F. Hasler, May 03 2019

A102084 a(1) = 0; for n>0, write 2n=p+q (p, q prime), p*q maximal; then a(n)=p*q (see A073046).

Original entry on oeis.org

0, 4, 9, 15, 25, 35, 49, 55, 77, 91, 121, 143, 169, 187, 221, 247, 289, 323, 361, 391, 437, 403, 529, 551, 589, 667, 713, 703, 841, 899, 961, 943, 1073, 1147, 1189, 1271, 1369, 1363, 1517, 1591, 1681, 1763, 1849, 1927, 2021, 1891, 2209, 2279, 2257, 2491
Offset: 1

Views

Author

Michael Taktikos, Feb 16 2005

Keywords

Comments

For n>1, largest semiprime whose sum of prime factors = 2n. Assumes the Goldbach conjecture is true. Also the largest semiprime <= n^2.
Also the greatest integer x such that x' = 2*n, or 0 if there is no such x, where x' is the arithmetic derivative (A003415). Bisection of A099303. The only even number without an anti-derivative is 2. All terms are <= n^2, with equality only when n is prime. In fact a(n) = n^2 - k^2, where k is the least number such that both n-k and n+k are prime; k = A047160(n). It appears that the anti-derivatives of even numbers are overwhelmingly semiprimes of the form n^2 - k^2. For example, 1000 has 28 anti-derivatives, all of this form. Sequence A189763 lists the even numbers that have anti-derivatives not of this form. - T. D. Noe, Apr 27 2011

Examples

			n=13: 2n = 26; 26 = 23 + 3 = 19 + 7 = 13 + 13; 13*13 = maximal => p*q = 13*13 = 169.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{pf = FactorInteger[n]}, If[Plus @@ Last /@ pf == 2, If[ Length[pf] == 2, Plus @@ First /@ pf, 2pf[[1, 1]]], 0]]; t = Table[0, {51}]; Do[a = f[n]; If[ EvenQ[a] && 0 < a < 104, t[[a/2]] = n], {n, 2540}]; t (* Robert G. Wilson v, Jun 14 2005 *)
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, 0, (n - k)*(n + k)], {n, 100}] (* T. D. Noe, Apr 27 2011 *)

Formula

a(n) = n^2 - A047160(n)^2. - Jason Kimberley, Jun 26 2012

Extensions

Edited by N. J. A. Sloane, Aug 29 2008 at the suggestion of R. J. Mathar

A047949 a(n) is the largest m such that n-m and n+m are both primes, or -1 if no such m exists.

Original entry on oeis.org

0, 0, 1, 2, 1, 4, 5, 4, 7, 8, 7, 10, 9, 8, 13, 14, 13, 12, 17, 16, 19, 20, 19, 22, 21, 20, 25, 24, 23, 28, 29, 28, 27, 32, 31, 34, 35, 34, 33, 38, 37, 40, 39, 38, 43, 42, 41, 30, 47, 46, 49, 50, 49, 52, 53, 52, 55, 54, 53, 48, 51, 50, 45, 62, 61, 64, 63, 62, 67, 68, 67, 66
Offset: 2

Views

Author

Keywords

Comments

A067076 is a subsequence of this sequence: when 2m+3 is prime a(m+3) = m. Moreover, it is the subsequence of records (maximal increasing subsequence): let m=a(n), with p=n-m and q=p+2m both odd primes > 3; now 3+2(m+(p-3)/2)=q and hence a(3+m+(p-3)/2) >= m+(p-3)/2 > m = a(n) but 3+m+(p-3)/2 < n. - Jason Kimberley, Aug 30 2012 and Oct 10 2012
Goldbach's conjecture says a(n) >= 0 for all n. - Robert Israel, Apr 15 2015
a(n) is the Goldbach partition of 2n which results in the maximum spread divided by 2. - Robert G. Wilson v, Jun 18 2018

Examples

			49-30=19 and 49+30=79 are primes, so a(49)=30.
		

Crossrefs

Programs

  • Haskell
    a047949 n = if null qs then -1 else head qs  where
       qs = [m | m <- [n, n-1 .. 0], a010051' (n+m) == 1, a010051' (n-m) == 1]
    -- Reinhard Zumkeller, Nov 02 2015
  • Maple
    a:= proc(n)
    local k;
      for k from n - 1 to 0 by -2 do
         if isprime(n+k) and isprime(n-k) then return(k) fi
    od:
    -1
    end proc:
    0, seq(a(n),n=3..1000); # Robert Israel, Apr 16 2015
  • Mathematica
    a[2] = a[3] = 0; a[n_] := (For[m = n - 2, m >= 0, m--, If[PrimeQ[n - m] && PrimeQ[n + m], Break[]]]; m); Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Sep 04 2013 *)
    lm[n_]:=Module[{m=n-2},While[!AllTrue[n+{m,-m},PrimeQ],m--];m]; Join[{0,0}, Array[ lm,70,4]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 03 2014 *)
    f[n_] := Block[{q = 2}, While[q <= n && !PrimeQ[2n -q], q = NextPrime@ q]; n - q]; Array[f, 72, 2] (* Robert G. Wilson v, Jun 18 2018 *)
  • PARI
    a(n) = {if (n==2 || n==3, return (0)); my(m = 1, lastm = -1, do = 1); while (do, if (isprime(n-m) && isprime(n+m), lastm = m); m++; if (m == n - 1, do = 0);); return (lastm);} \\ Michel Marcus, Jun 09 2013
    
  • PARI
    a(n)=if(n<4,0,forprime(p=3,n-1,if(isprime(2*n-p),return(n-p)));-1) \\ Ralf Stephan, Dec 29 2013
    

Formula

a(n) = n - A020481(n).
a(n) = (A020482(n) - A020481(n))/2. - Gionata Neri, Apr 15 2015

Extensions

Corrected by Harvey P. Dale, Dec 21 2000
Showing 1-10 of 18 results. Next