OFFSET
4,1
FORMULA
Straddle primes are the nearest primes preceding and following composite n.
EXAMPLE
The first straddle prime pair is 3 and 5 which straddles the composite number 4 and 5-3 = 2 the first entry in the table.
MATHEMATICA
NextPrime[#]-NextPrime[#, -1]&/@Rest[Select[Range[200], !PrimeQ[#]&]] (* Harvey P. Dale, Aug 23 2012 *)
PROG
(PARI) straddiff(n) = { local (x, y, pp, np); for(x=1, n, y=composite(x); pp=precprime(y); np=nextprime(y); print1(np-pp", ") )
composite(n) = { local(c, x); c=1; x=1; while(c <= n, x++; if(!isprime(x), c++); ); return(x) } }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, Mar 13 2005
STATUS
approved