cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A080733 Smallest distance from n to a squarefree number.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Mar 08 2003

Keywords

Comments

a(n) = min (abs(n-k) : where k runs through the squarefree numbers ).
The sequence is unbounded.
The first 0 occurs at 1, the first 1 at 4, the first 2 at 49, the first 3 at 846. - Antti Karttunen, Sep 22 2017

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.
		

Crossrefs

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