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

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

A002091 From a Goldbach conjecture: the location of records in A185091.

Original entry on oeis.org

3, 9, 19, 21, 55, 115, 193, 323, 611, 1081, 1571, 10771, 13067, 16321, 44881, 57887, 93167, 189947, 404939, 442307, 1746551, 3383593, 3544391, 5056787, 7480667, 25619213, 87170987, 404940757, 526805663, 707095391, 1009465507, 1048720723, 5315914139
Offset: 1

Views

Author

Keywords

Comments

A stronger version of the second Goldbach conjecture (every odd number can be expressed as the sum of 3 primes) states that every odd number k > 5 can be written as k = 2*p + q, p, q prime. The conjecture was posed by E. Lemoine and later by H. Levy. The article by B. H. Mayoh assumes q {1,prime}. For the representations of k minimizing q, the sequence gives the value of k at which a larger q than for all representations of j < k is required. The new record value of q is given in A002092. The corresponding sequences for q prime and q=1 excluded are A194828 and A194829. - Hugo Pfoertner, Sep 03 2011
k is in this list when (k+1)/2 is the index of a record in A185091.
Checked up to k=10^13. a(50) is > 10^13. - Hugo Pfoertner, Sep 25 2011

Examples

			a(3)=19, because it is the first number for which q=5 is required. 3=2*1+1, 5=2*2+1, 7=2*3+1, 9=2*3+3, 11=2*5+1, 13=2*5+3, 15=2*7+1, 17=2*7+3, 19=2*7+5.
		

References

  • Brian H. Mayoh, On the second Goldbach conjecture, Nordisk Tidskr. Informations-Behandling 6, 1966, 48-50.
  • Emile Lemoine, L'intermédiaire des mathématiciens, 1 (1894), 179; ibid 3 (1896), 151.
  • 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

Cf. A002092 [values of q], A194828, A194829 [equivalent with q=1 excluded].
Cf. A185091.

Extensions

a(19)-a(32) from Hugo Pfoertner, Sep 03 2011
a(33) from Jason Kimberley, a(34)-a(40) from Hugo Pfoertner, Sep 09 2011
a(41)-a(49) from Hugo Pfoertner, Sep 25 2011

A194828 Odd numbers n>5 in the representation n=2*p+q, p, q prime, q minimal, at which a larger q than for any smaller n is needed. A194829 gives values of q.

Original entry on oeis.org

7, 11, 21, 23, 55, 83, 167, 611, 887, 1487, 1571, 10771, 12227, 13523, 16321, 44881, 54863, 57887, 93167, 189947, 404939, 442307, 1746551, 3383593, 3544391, 5056787, 6811307, 25619213, 87170987, 404940757, 526805663, 707095391, 1009465507, 1048720723
Offset: 1

Views

Author

Hugo Pfoertner, Sep 03 2011

Keywords

Comments

Related to Lemoine's conjecture, similar to A002091, but with q=1 excluded. Checked up to 2*10^13.

Examples

			a(4)=23, because 23 can only be represented by 23=2*5+13, whereas in A002091 23=2*11+1 avoids the need of increasing q for this representation.
		

References

Crossrefs

A194829 Records of primes q in the representation of odd n>5 by n=2*p+q, p, q prime, q minimal. A194828 gives the values of n at which an increase of q is required.

Original entry on oeis.org

3, 5, 7, 13, 17, 37, 61, 73, 109, 181, 277, 317, 349, 397, 419, 503, 577, 601, 709, 829, 877, 1129, 1237, 1367, 1429, 1669, 1993, 2467, 2833, 2879, 3001, 3037, 3329, 3821, 4861, 5003, 5281, 5821, 5897, 6301, 6329, 6421, 7129, 7309, 7873, 8017, 8597, 8821, 8969, 9157
Offset: 1

Views

Author

Hugo Pfoertner, Sep 03 2011

Keywords

Comments

See A002091. Checked up to n=2*10^13.

Examples

			a(5)=17, because it is the smallest possible value of q in the representation of 55=2*p+q. 55-3=52, 55-5=50, 55-7=48, 55-11=44, 55-13=42, none of which has the form 2*p. 55-17=38=2*19. All odd numbers < 55 can be represented using a q<17.
		

References

Crossrefs

Cf. A194828, A002091, A002092 [q=1 allowed], A195354.

Extensions

a(35)-a(43) from Hugo Pfoertner, Sep 11 2011
a(44)-a(49) from Hugo Pfoertner, Sep 18 2011
a(50) from Hugo Pfoertner, Sep 22 2011

A185091 The smallest positive noncomposite q such that 2n-1 = 2p+q for some positive noncomposite p.

Original entry on oeis.org

1, 1, 1, 3, 1, 3, 1, 3, 5, 7, 1, 3, 1, 3, 5, 7, 1, 3, 1, 3, 5, 7, 1, 3, 5, 7, 17, 11, 1, 3, 1, 3, 5, 7, 13, 11, 1, 3, 5, 7, 1, 3, 1, 3, 5, 7, 1, 3, 5, 7, 17, 11, 1, 3, 5, 7, 29, 11, 1, 3, 1, 3, 5, 7, 13, 11, 1, 3, 5, 7, 1, 3, 1, 3, 5, 7, 13, 11, 1, 3, 5, 7, 1, 3, 5, 7, 17, 11, 1, 3, 5, 7, 29
Offset: 2

Views

Author

Jason Kimberley (with thanks to Hugo Pfoertner), Sep 05 2011

Keywords

Comments

It is a Goldbach conjecture variant that terms exist for 2n-1 >= 5.
Lemma: N=2n-1 is coprime to q=a(n) unless N=3q. Proof: Suppose N and q are not coprime; so we have N=2p+q=iq with i=/=1=/=q, so (i-1)q=2p; now since q=/=2 (because N is odd), then q=p and i=3. QED.
Empirically, N=3q only for N=9,21.

References

  • Emile Lemoine, L'intermédiaire des mathématiciens, 1 (1894), 179; ibid 3 (1896), 151.

Crossrefs

Records in this sequence are in A002092 occurring at 2n-1 in A002091.

Programs

Showing 1-5 of 5 results.