OFFSET
0,1
COMMENTS
LINKS
EXAMPLE
a(0)=2 because 2-0 and 2+0 are primes. 2 is the least such value.
a(1)=4 because 4-1 and 4+1 are prime, but 4-0 and 4-0 are not prime. 4 is the least such value.
a(2)=9 because 9-2 and 9+2 are prime, but (8,10) and (9,9) are not prime pairs. 9 is the least such value.
a(3)=8 because 8-3 and 8+3 are prime, but (6,10), (7,9) and (8,8) are not prime pairs. 8 is the least such value.
a(11)=222 because 211 and 233 are prime, but (222-m,222+m) is not a prime pair for any m<11. 222 is the least such value.
MATHEMATICA
primePairQ[k_, n_] := PrimeQ[k+n]&&PrimeQ[k-n]; SetAttributes[primePairQ, Listable]; Table[k=n+2; While[ !primePairQ[k, n] || (Or@@primePairQ[k, Range[0, n-1]]), k++ ]; k, {n, 0, 55}]
PROG
g(1) = 0; for i = 2:100001 if isprime(i) g(i) = 0; else g(i) = 1; while not(isprime(i - g(i)) & isprime(i + g(i))) g(i) = g(i) + 1; end end end f = g - g; for i = 2:100001 if g(i) > 0 if f(g(i)) == 0 f(g(i)) = i; end end end
(Haskell)
import Data.List (elemIndex); import Data.Maybe (fromJust)
a103147 = (+ 2) . fromJust . (`elemIndex` a047160_list)
-- Reinhard Zumkeller, Aug 10 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Lei Zhou, Jan 26 2005
EXTENSIONS
Edited by Ray Chandler and T. D. Noe, Feb 01 2005
STATUS
approved