login
A378619
Distance between n and the greatest squarefree number <= n.
3
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,9
LINKS
FORMULA
a(n) = n - A070321(n).
MATHEMATICA
Table[n-NestWhile[#-1&, n, !SquareFreeQ[#]&], {n, 100}]
PROG
(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
(PARI) A378619(n) = forstep(k=n, 1, -1, if(issquarefree(k), return(n-k))); \\ Antti Karttunen, Jan 29 2025
CROSSREFS
Positions of 0 are A005117.
Positions of first appearances are A020755 - 1.
Positions of 1 are A053806.
Subtracting each term from n gives A070321.
The opposite version is A081221.
Restriction to the primes is A240473, opposite A240474.
A013929 lists the nonsquarefree numbers, differences A078147.
A061398 counts squarefree numbers between primes, zeros A068360.
A061399 counts nonsquarefree numbers between primes, zeros A068361.
Sequence in context: A219486 A284574 A206499 * A277885 A333842 A334109
KEYWORD
nonn,changed
AUTHOR
Gus Wiseman, Dec 12 2024
EXTENSIONS
Data section extended to a(105) by Antti Karttunen, Jan 29 2025
STATUS
approved