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-9 of 9 results.

A277581 Goldbach's problem extended to squares of nonnegative differences of primes: smallest integer >= ((A112823(n) - A234345(n))^2)/n for n >= 2.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 5, 2, 4, 0, 1, 0, 3, 2, 3, 0, 1, 0, 2, 1, 15, 0, 5, 6, 2, 3, 12, 0, 1, 0, 11, 2, 2, 5, 3, 0, 9, 1, 1, 0, 1, 0, 1, 1, 20, 0, 3, 12, 1, 6, 7, 0, 4, 11, 1, 2, 16, 0, 1, 0, 6, 2, 1, 3, 2, 0, 14, 1, 1, 0, 1, 0, 13, 1, 1, 2, 2, 0, 5, 1, 11, 0, 2, 7, 1, 10, 4, 0
Offset: 2

Views

Author

Juri-Stepan Gerasimov, Oct 21 2016

Keywords

Comments

Where A112823(n) + A234345(n) = 2n and A112823(n) <= A234345(n) (or nonnegative differences of primes). If n is prime, then a(n) = 0.
Conjecture: 1 <= a(n) <= m for all n, where m is largest value of a(n), i.e., the sequence of records in a(n) {1, 5, 15, 20, ..., m} is finite.

Examples

			a(8) = 5 because ((A112823(8) - A234345(8))^2)/8 = ((5 - 11)^2)/8 < 5, where 5(prime) + 11(prime) = 2*8;
a(9) = 2 because ((A112823(9) - A234345(9))^2)/9 = ((7 - 11)^2)/9 < 2, where 7(prime) + 11(prime) = 2*9;
a(10) = 4 because ((A112823(10) - A234345(10))^2)/10 = ((7 - 13)^2)/10 < 4, where 7(prime) + 13(prime) = 2*10.
		

Crossrefs

Cf. A112823 (2 together with A002374), A234345, A277583 (Goldbach's problem extended to squares of prime gaps >= 2).

A047160 For n >= 2, a(n) = smallest number m >= 0 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, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0, 5, 12, 3, 14, 9, 0, 7, 12, 9, 4, 15, 6, 7, 0, 9, 2, 3
Offset: 2

Views

Author

Keywords

Comments

I have confirmed there are no -1 entries through integers to 4.29*10^9 using PARI. - Bill McEachen, Jul 07 2008
From Daniel Forgues, Jul 02 2009: (Start)
Goldbach's Conjecture: for all n >= 2, there are primes (distinct or not) p and q s.t. p+q = 2n. The primes p and q must be equidistant (distance m >= 0) from n: p = n-m and q = n+m, hence p+q = (n-m)+(n+m) = 2n.
Equivalent to Goldbach's Conjecture: for all n >= 2, there are primes p and q equidistant (distance >= 0) from n, where p and q are n when n is prime.
If this conjecture is true, then a(n) will never be set to -1.
Twin Primes Conjecture: there is an infinity of twin primes.
If this conjecture is true, then a(n) will be 1 infinitely often (for which each twin primes pair is (n-1, n+1)).
Since there is an infinity of primes, a(n) = 0 infinitely often (for which n is prime).
(End)
If n is composite, then n and a(n) are coprime, because otherwise n + a(n) would be composite. - Jason Kimberley, Sep 03 2011
From Jianglin Luo, Sep 22 2023: (Start)
a(n) < primepi(n)+sigma(n,0);
a(n) < primepi(primepi(n)+n);
a(n) < primepi(n), for n>344;
a(n) = o(primepi(n)), as n->+oo. (End)
If -1 < a(n) < n-3, then a(n) is divisible by 3 if and only if n is not divisible by 3, and odd if and only if n is even. - Robert Israel, Oct 05 2023

Examples

			16-3=13 and 16+3=19 are primes, so a(16)=3.
		

Crossrefs

Programs

  • Haskell
    a047160 n = if null ms then -1 else head ms
                where ms = [m | m <- [0 .. n - 1],
                                a010051' (n - m) == 1, a010051' (n + m) == 1]
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Magma
    A047160:=func;[A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011
    
  • Mathematica
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]
    smm[n_]:=Module[{m=0},While[AnyTrue[n+{m,-m},CompositeQ],m++];m]; Array[smm,100,2] (* Harvey P. Dale, Nov 16 2024 *)
  • PARI
    a(n)=forprime(p=n,2*n, if(isprime(2*n-p), return(p-n))); -1 \\ Charles R Greathouse IV, Jun 23 2017
  • UBASIC
    10 N=2// 20 M=0// 30 if and{prmdiv(N-M)=N-M,prmdiv(N+M)=N+M} then print M;:goto 50// 40 inc M:goto 30// 50 inc N: if N>130 then stop// 60 goto 20
    

Formula

a(n) = n - A112823(n).
a(n) = A082467(n) * A005171(n), for n > 3. - Jason Kimberley, Jun 25 2012

Extensions

More terms from Patrick De Geest, May 15 1999
Deleted a comment. - T. D. Noe, Jan 22 2009
Comment corrected and definition edited by Daniel Forgues, Jul 08 2009

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

A184995 Irregular triangle T, read by rows, in which row n lists the primes p <= n such that 2n-p is also prime.

Original entry on oeis.org

2, 3, 3, 3, 5, 5, 3, 7, 3, 5, 5, 7, 3, 7, 3, 5, 11, 5, 7, 11, 3, 7, 13, 5, 11, 7, 11, 13, 3, 13, 3, 5, 11, 17, 5, 7, 13, 17, 7, 19, 3, 11, 17, 5, 11, 13, 19, 3, 7, 13, 3, 5, 17, 23, 5, 7, 11, 17, 19, 3, 7, 13, 19, 5, 11, 23, 7, 11, 13, 17, 23, 3, 13, 19, 5, 11, 17, 29, 7, 13, 17, 19, 23, 29
Offset: 2

Views

Author

Jason Kimberley, Sep 03 2011

Keywords

Comments

Row n has first entry A020481(n), length A045917(n), and last entry A112823(n).
Each row is the prefix to the middle of the corresponding row of A171637.
The Goldbach conjecture states that this irregular Goldbach triangle has in each row at least one entry (A045917(n) >= 1). - Wolfdieter Lang, May 14 2016

Examples

			The irregular triangle T(n, i) starts:
n, 2*n\i  1   2   3   4   5   6 ...
2,   4    2
3,   6    3
4,   8    3
5,  10    3   5
6,  12    5
7,  14    3   7
8,  16    3   5
9,  18    5   7
10, 20    3   7
11, 22    3   5  11
12, 24    5   7  11
13, 26    3   7  13
14, 28    5  11
15, 30    7  11  13
16, 32    3  13
17, 34    3   5  11  17
18, 36    5   7  13  17
19, 38    7  19
20, 40    3  11  17
21, 42    5  11  13  19
22, 44    3   7  13
23, 46    3   5  17  23
24, 48    5   7  11  17  19
25, 50    3   7  13  19
26, 52    5  11  23
27, 54    7  11  13  17  23
28, 56    3  13  19
29, 58    5  11  17  29
30, 60    7  13  17  19  23  29
... reformatted - _Wolfdieter Lang_, May 14 2016
		

Crossrefs

Programs

  • Magma
    A184995 := func;
    &cat[A184995(n):n in [2..30]];
  • Maple
    T:= n-> seq(`if`(andmap(isprime, [p, 2*n-p]), p, NULL), p=2..n):
    seq(T(n), n=2..40);  # Alois P. Heinz, Jan 09 2025
  • Mathematica
    Table[Select[Prime@ Range@ PrimePi@ n, PrimeQ[2 n - #] &], {n, 2, 30}] // Flatten (* Michael De Vlieger, May 14 2016 *)
    T[n_] := Table[If[PrimeQ[p] && PrimeQ[2n-p], p, Nothing], {p, 2, n}];
    Table[T[n], {n, 2, 30}] // Flatten (* Jean-François Alcover, Jan 09 2025, after Alois P. Heinz in A182138 *)

Formula

T(n,i) = n - A182138(n,i). - Jason Kimberley, Sep 25 2012

A234345 Smallest q such that n <= q < 2n with p, q both prime, p+q = 2n, and p <= q.

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Dec 23 2013

Keywords

Comments

Also, the larger part in the Goldbach partition of 2n with the smallest difference between its prime parts.

Examples

			a(9) = 11; the Goldbach partitions of 2(9) = 18 are (13,5) and (11,7).  The partition with smaller difference between the primes is (11,7) (difference 4) and the larger part of this partition is 11.
		

Crossrefs

Cf. A112823.

Programs

  • Mathematica
    f[n_] := Block[{p = n/2}, While[! PrimeQ[p] || ! PrimeQ[n - p], p--];
      n - p]; Table[f[n], {n, 4, 146, 2}]
  • PARI
    a(n) = {my(q = nextprime(n)); while (!isprime(2*n-q), q = nextprime(q+1)); q;} \\ Michel Marcus, Oct 22 2016

Formula

a(n) = 2n - A112823(n).

A325142 a(n) = k if (n - k, n + k) is the centered Goldbach partition of 2n if it exists and -1 otherwise.

Original entry on oeis.org

-1, -1, 0, 0, 1, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0
Offset: 0

Views

Author

Peter Luschny, May 02 2019

Keywords

Comments

Let N = 2*n = p + q where p and q are primes. We call such a pair (p, q) a Goldbach partition of N. A centered Goldbach partition is the Goldbach partition of the form (n - k, n + k) where k >= 0 is minimal. If N has a centered Goldbach partition then a(n) is this k and otherwise -1.
According to Goldbach's conjecture, any even N = 2n > 2 has a Goldbach partition, which is necessarily of the form p = n - k, q = n + k: namely, with n = (p+q)/2 and k = (q-p)/2. - M. F. Hasler, May 02 2019

Examples

			a(162571) = 78 because 325142 = 162493 + 162649 and there is no k, 0 <= k < 78, such that (162571 - k, 162571 + k) is a Goldbach partition of 325142.
		

Crossrefs

Programs

  • Maple
    a := proc(n) local k; for k from 0 to n do
    if isprime(n + k) and isprime(n - k) then return k fi od: -1 end:
    seq(a(n), n=0..83);
  • Mathematica
    a[n_] := Module[{k}, For[k = 0, k <= n, k++, If[PrimeQ[n+k] && PrimeQ[n-k], Return[k]]]; -1]; Table[a[n], {n, 0, 83}] (* Jean-François Alcover, Jul 06 2019, from Maple *)
  • PARI
    a(n) = for(k=0, n, if(ispseudoprime(n+k) && ispseudoprime(n-k), return(k))); -1 \\ Felix Fröhlich, May 02 2019
    
  • PARI
    apply( A325142(n)=-!forprime(p=n,2*n, isprime(n*2-p)&&return(p-n)), [0..99]) \\ M. F. Hasler, May 02 2019

Formula

a(n) = n - A112823(n) = A234345(n) - n (= n - A002374(n) for n > 2). - M. F. Hasler, May 02 2019
a(n) = A047160(n) = A066285(n)/2 for n >= 2. - Alois P. Heinz, Jun 01 2020

A112824 Consider the Goldbach conjecture that every even number 2n=p+p' with p<=p'. Consider all such Goldbach partitions; a(n) is the difference between the largest p and the smallest p. Call this difference the Goldbach gap.

Original entry on oeis.org

0, 0, 0, 2, 0, 4, 2, 2, 4, 8, 6, 10, 6, 6, 10, 14, 12, 12, 14, 14, 10, 20, 14, 16, 18, 16, 16, 24, 22, 28, 20, 24, 24, 26, 26, 34, 26, 32, 30, 38, 36, 40, 36, 36, 28, 42, 36, 18, 44, 38, 40, 50, 42, 40, 50, 48, 40, 54, 52, 48, 42, 46, 42, 56, 56, 64, 48, 60, 64, 68, 66, 66, 48, 60
Offset: 2

Views

Author

Robert G. Wilson v, Sep 05 2005

Keywords

Comments

The gap is always even.

Crossrefs

Cf. A020481.

Programs

  • Mathematica
    f[n_] := Block[{p = 2, q = n/2}, While[ !PrimeQ[p] || !PrimeQ[n - p], p++ ]; While[ !PrimeQ[q] || !PrimeQ[n - q], q-- ]; q - p]; Table[ f[n], {n, 4, 150, 2}]

Formula

A137982 Closest pair of primes p <= q such that p + q = n! Sequence gives the lesser member p of the pair.

Original entry on oeis.org

3, 11, 59, 353, 2447, 20147, 181421, 1814347, 19958353, 239500727, 3113510341, 43589145527, 653837183849, 10461394943537, 177843714047843, 3201186852863803, 60822550204415273, 1216451004088319887, 25545471085854719707, 562000363888803839453, 12926008369442488319633
Offset: 3

Views

Author

Zak Seidov, Apr 29 2008

Keywords

Examples

			3! = 3 + 3,
4! = 11 + 13,
5! = 59 + 61,
6! = 353 + 367.
p = 3,11,59,353,2447,20147,181421,1814347,19958353,239500727,3113510341,43589145527,653837183849;
q = 3,13,61,367,2593,20173,181459,1814453,19958447,239500873,3113510459,43589145673,653837184151;
q-p = 0,2,2,14,146,26,38,106,94,146,118,146,302.
		

Crossrefs

Cf. A112823.

Programs

  • PARI
    \\ here b(n) is A112823.
    b(n)={my(p=precprime(n)); while(p && !isprime(2*n-p), p = precprime(p-1)); p}
    a(n)={b(n!/2)} \\ Andrew Howroyd, Feb 02 2020

Formula

a(n) = A112823(n!/2). - Andrew Howroyd, Feb 02 2020

Extensions

Terms a(16) and beyond from Andrew Howroyd, Feb 02 2020

A328298 The smaller prime in the decomposition of 2n (>=6) into a sum of two odd primes obtained from increasing the smaller prime of such a decomposition of 2n-2.

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, 17, 19, 19, 23, 23, 19, 29, 29, 31, 23, 29, 31, 29, 31, 37, 29, 31, 37, 41, 41, 43, 41, 43, 31, 41, 43, 37, 41, 43, 43, 47, 47, 43, 53, 53, 43, 47, 53, 61, 53, 59, 61, 59, 61, 67, 53, 59
Offset: 3

Views

Author

Lei Zhou, Oct 11 2019

Keywords

Comments

This sequence is different from A002374 from the 23rd term on.

Examples

			For the 3rd even number 6, 6=3+3;
For the 4th number 8, increasing the first prime in 6=3+3 by 2, we get 8=5+3, 5 and 3 are both primes, choose the smaller one, the second term of this sequence is 3, which makes 8=3+5;
...
For the 23rd even number 46, increasing the first prime in 44=13+31 by 2, we get 46=15+31.  15 is not prime, keep increasing: 46=17+29.  Both 17 and 29 are primes, so the 23rd term of this sequence is 17, as of 46=17+29;
...
For 28th even number 56, increasing the first prime in 54=23+31 by 2, we get 56=25+31.  25 is not prime, keep increasing, 56 = 27+29 = 29+27 = 31+25 = 33+23 = 35+21 = 37+19.  Both 37 and 19 are primes, and 19 is smaller.  So the 28th term of this sequence is 19, as of 56=19+37.
		

Crossrefs

Programs

  • Mathematica
    e = 4; p1 = 1; p2 = 3; a = Table[e = e + 2; If[p1 < p2, p1 = p1 + 2, p2 = p2 + 2];
      While[! (PrimeQ[p1] && PrimeQ[p2]), p1 = p1 + 2; p2 = p2 - 2];
      If[p1 > p2, p1 = p2; p2 = e - p1]; p1, {i, 1, 67}]
Showing 1-9 of 9 results.