login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A053543
Distance to closest prime in sequence of composites.
0
1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 2, 1, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 1, 2, 3, 2, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 1
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
Sequence in context: A161100 A342007 A341997 * A161099 A118663 A205119
KEYWORD
easy,nonn
AUTHOR
Enoch Haga, Jan 16 2000
STATUS
approved