OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..2500
EXAMPLE
The 1st nonprime is 1, the 1st prime is 2, so a(1) = 2 - 1 = 1.
The 2nd nonprime is 4, the 4th prime is 7, so a(2) = 7 - 4 = 3.
MAPLE
A018252 := proc(n) if n = 1 then 1; else for a from procname(n-1)+1 do if not isprime(a) then return a ; fi; od: fi; end proc: A168285 := proc(n) local c; c := A018252(n) ; ithprime(c)-c ; end proc: seq(A168285(n), n=1..100) ; # R. J. Mathar, Nov 30 2009
MATHEMATICA
Prime[#]-#&/@Select[Range[100], !PrimeQ[#]&] (* Harvey P. Dale, Jun 16 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Nov 22 2009
EXTENSIONS
Name clarified by Jon E. Schoenfield, May 12 2019
STATUS
approved