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

A378619
Distance between n and the greatest squarefree number <= n.
0
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
OFFSET
1,9
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
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,new
AUTHOR
Gus Wiseman, Dec 12 2024
STATUS
approved