A080733 Smallest distance from n to a squarefree number.
0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2, 1, 0, 0, 0, 1, 0
Offset: 1
Keywords
Examples
For n = 3, 3 itself is a squarefree number, thus a(3) = 0. For n = 48, 48 = 2^4 * 3 is not squarefree, 49 = 7^2 is not squarefree, but 47 is, thus a(48) = abs(48-47) = 1. For n = 49, neither 49 = 7^2, nor 48 = 2^4 * 3 nor 50 = 2^2 * 5 is squarefree, while both 47 and 51 are, thus a(49) = abs(49-47) = abs(49-51) = 2.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537
Programs
-
Mathematica
nn=110;With[{sqfr=Select[Range[nn+10],SquareFreeQ]},Flatten[Table[ Union[ Abs[ Nearest[ sqfr,n]-n]],{n,nn}]]] (* Harvey P. Dale, Jun 01 2012 *)
-
PARI
A080733(n) = { my(k=0); while((!issquarefree(n+k))&&(!issquarefree(n-k)),k++); k; }; \\ Antti Karttunen, Sep 22 2017
Formula
a(A005117(n)) = 0.
Extensions
Examples added by Antti Karttunen, Sep 22 2017
Comments