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

A338228
Number of numbers less than or equal to n whose square does not divide n.
7
0, 1, 2, 2, 4, 5, 6, 6, 7, 9, 10, 10, 12, 13, 14, 13, 16, 16, 18, 18, 20, 21, 22, 22, 23, 25, 25, 26, 28, 29, 30, 29, 32, 33, 34, 32, 36, 37, 38, 38, 40, 41, 42, 42, 43, 45, 46, 45, 47, 48, 50, 50, 52, 52, 54, 54, 56, 57, 58, 58, 60, 61, 61, 60, 64, 65, 66, 66, 68, 69, 70, 68, 72
OFFSET
1,3
LINKS
FORMULA
a(n) = n - Sum_{k=1..n} (1 - ceiling(n/k^2) + floor(n/k^2)).
a(n) = n - tau(sqrt(n/A007913(n))) = n - A000005(sqrt(n/A007913(n))). - Chai Wah Wu, Feb 01 2021
a(n) = Sum_{k=1..n} sign(n mod k^2). - Wesley Ivan Hurt, May 09 2021
EXAMPLE
a(3) = 2; 1^2|3, but 2^2 and 3^2 do not. So a(3) = 2.
a(4) = 2; 1^2|4 and 2^2|4 but 3^2 and 4^2 do not, So a(4) = 2.
MATHEMATICA
Table[Sum[Ceiling[n/k^2] - Floor[n/k^2], {k, n}], {n, 100}]
PROG
(PARI) a(n) = sum(k=1, n, if (n % k^2, 1)); \\ Michel Marcus, Jan 31 2021
(Python)
from sympy import divisor_count, integer_nthroot
from sympy.ntheory.factor_ import core
def A338228(n):
return n-divisor_count(integer_nthroot(n//core(n, 2), 2)[0]) # Chai Wah Wu, Feb 01 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jan 30 2021
STATUS
approved