OFFSET
1,4
FORMULA
Beginning at 2, list consecutive numbers. Measure distance of each composite to nearest prime.
EXAMPLE
Fourth composite number is 9; distance to nearest prime, 7 or 11, is 2, so a(4) = 2.
MATHEMATICA
Min[NextPrime[#]-#, #-NextPrime[#, -1]]&/@Select[Range[140], CompositeQ] (* Harvey P. Dale, Aug 31 2015 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Enoch Haga, Jan 16 2000
STATUS
approved