A378619 Distance between n and the greatest squarefree number <= n.
0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 2, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 2, 3, 0, 0, 0, 1, 0
Offset: 1
Keywords
Links
- Antti Karttunen, Table of n, a(n) for n = 1..30000
Crossrefs
Programs
-
Mathematica
Table[n-NestWhile[#-1&,n,!SquareFreeQ[#]&],{n,100}]
-
PARI
A378619(n) = forstep(k=n,1,-1,if(issquarefree(k), return(n-k))); \\ Antti Karttunen, Jan 29 2025
-
Python
from itertools import count from sympy import factorint def A378619(n): return n-next(m for m in count(n,-1) if max(factorint(m).values(),default=0)<=1) # Chai Wah Wu, Dec 14 2024
Formula
a(n) = n - A070321(n).
Extensions
Data section extended to a(105) by Antti Karttunen, Jan 29 2025