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!)
A082467 Least k>0 such that n-k and n+k are both primes. 21
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

4,2

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 03 and 21, 2011

LINKS

Klaus Brockhaus, Table of n, a(n) for n = 4..5000

OEIS (Plot 2), log_10(A082467(n)/n) vs n

J. S. Kimberley, A082467

FORMULA

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

EXAMPLE

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.

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 *)

PROG

(PARI) a(n)=if(n<0, 0, k=1; while(isprime(n-k)*isprime(n+k) == 0, k++); k)

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

CROSSREFS

Cf. A087695, A087696, A087697, A087678, A087679, A087680, A087681, A087682, A087683, A087711.

Cf. A129301 (records), A129302 (where records occur).

Cf. A047160 (allows k=0).

Cf. A078611 (subset for prime n).

Sequence in context: A277749 A227629 A183201 * A106407 A023141 A283324

Adjacent sequences:  A082464 A082465 A082466 * A082468 A082469 A082470

KEYWORD

nonn

AUTHOR

Benoit Cloitre, Apr 27 2003

EXTENSIONS

Entries checked by Klaus Brockhaus, Apr 08 2007

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 29 22:45 EDT 2017. Contains 287257 sequences.