The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A087242 Smallest prime number p such that n+p = q is also a prime, or 0 if no such prime number exists. 4
2, 3, 2, 3, 2, 5, 0, 3, 2, 3, 2, 5, 0, 3, 2, 3, 2, 5, 0, 3, 2, 7, 0, 5, 0, 3, 2, 3, 2, 7, 0, 5, 0, 3, 2, 5, 0, 3, 2, 3, 2, 5, 0, 3, 2, 7, 0, 5, 0, 3, 2, 7, 0, 5, 0, 3, 2, 3, 2, 7, 0, 5, 0, 3, 2, 5, 0, 3, 2, 3, 2, 7, 0, 5, 0, 3, 2, 5, 0, 3, 2, 7, 0, 5, 0, 3, 2, 13, 0, 7, 0, 5, 0, 3, 2, 5, 0, 3, 2, 3, 2, 5, 0, 3, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
FORMULA
a(n) = Min{x prime; n+x is prime}.
EXAMPLE
a(n)=0, i.e., no solution exists if n is a special prime, namely n is not a lesser twin prime; e.g., if n=7, then neither 7+2=9 nor 7+(odd prime) is a prime, thus no p prime exists such that 7+p is also a prime.
If n is a lesser twin prime then a(n)=2 is a solution because n+a(n) = n+2 = greater twin prime satisfying the condition.
PROG
(PARI) a(n) = {if (n % 2, if (isprime(n+2), p = 2, p = 0); , p = 2; while (!isprime(n+p), p = nextprime(p+1)); ); p; } \\ Michel Marcus, Dec 26 2013
CROSSREFS
Sequence in context: A329896 A366262 A303779 * A123556 A284017 A236454
KEYWORD
nonn
AUTHOR
Labos Elemer, Sep 04 2003
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 9 01:05 EDT 2024. Contains 373227 sequences. (Running on oeis4.)