login
This site is supported by donations to The OEIS Foundation.

 

Logo

The OEIS is looking to hire part-time people to help edit core sequences, upload scanned documents, process citations, fix broken links, etc. - Neil Sloane, njasloane@gmail.com

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 16
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

2,7

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

LINKS

T. D. Noe, Table of n, a(n) for n=2..10000

J. S. Kimberley, Symmetrical plot of A047160

FORMULA

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

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

EXAMPLE

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

MATHEMATICA

Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]

PROG

(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

(MAGMA) A047160:=func<n|exists(r){m:m in[0..n-2]|IsPrime(n-m)and IsPrime(n+m)}select r else-1>; [A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011

(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

CROSSREFS

Cf. A001031, A002092, A002372, A002373, A002374, A002375, A014092, A025583, A035026, A047949, A071406, A082467, A102084, A103147, A112823, A155764, A155765, A177461.

Cf. A078611. - Stanislav Sykora, Mar 14 2014

Cf. A010051, A045917.

Sequence in context: A016458 A058513 A285736 * A093347 A230409 A244543

Adjacent sequences:  A047157 A047158 A047159 * A047161 A047162 A047163

KEYWORD

nonn,easy,nice

AUTHOR

Lior Manor

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

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified May 26 01:26 EDT 2017. Contains 287073 sequences.