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”).

A240474
Distance from prime(n) to the closest larger squarefree number.
7
1, 2, 1, 3, 2, 1, 2, 2, 3, 1, 2, 1, 1, 3, 4, 2, 2, 1, 2, 2, 1, 3, 2, 2, 4, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 5, 2, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1, 3, 2, 2, 4, 1, 3, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 3, 2
OFFSET
1,2
FORMULA
a(n) = A112926(n) - A000040(n). - Michel Marcus, Apr 10 2014
EXAMPLE
a(9) = 3 because 3 is the gap between prime(9) = 23 and the closest larger squarefree number 26.
PROG
(PARI) forprime(p=1, 450, for(j=p+1, 2*p, if(issquarefree(j), print1(j-p", "); break)))
KEYWORD
nonn
AUTHOR
Chris Boyd, Apr 06 2014
STATUS
approved