OFFSET
1,1
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
KEYWORD
nonn
AUTHOR
Labos Elemer, Sep 04 2003
STATUS
approved