login
Number of numbers less than or equal to n whose square does not divide n.
7

%I #30 Jun 30 2021 09:06:30

%S 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,

%T 25,26,28,29,30,29,32,33,34,32,36,37,38,38,40,41,42,42,43,45,46,45,47,

%U 48,50,50,52,52,54,54,56,57,58,58,60,61,61,60,64,65,66,66,68,69,70,68,72

%N Number of numbers less than or equal to n whose square does not divide n.

%H Felix Fröhlich, <a href="/A338228/b338228.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = n - Sum_{k=1..n} (1 - ceiling(n/k^2) + floor(n/k^2)).

%F a(n) = n - tau(sqrt(n/A007913(n)) = n - A000005(sqrt(n/A007913(n)). - _Chai Wah Wu_, Feb 01 2021

%F a(n) = Sum_{k=1..n} sign(n mod k^2). - _Wesley Ivan Hurt_, May 09 2021

%e a(3) = 2; 1^2|3, but 2^2 and 3^2 do not. So a(3) = 2.

%e a(4) = 2; 1^2|4 and 2^2|4 but 3^2 and 4^2 do not, So a(4) = 2.

%t Table[Sum[Ceiling[n/k^2] - Floor[n/k^2], {k, n}], {n, 100}]

%o (PARI) a(n) = sum(k=1, n, if (n % k^2, 1)); \\ _Michel Marcus_, Jan 31 2021

%o (Python)

%o from sympy import divisor_count, integer_nthroot

%o from sympy.ntheory.factor_ import core

%o def A338228(n):

%o return n-divisor_count(integer_nthroot(n//core(n,2),2)[0]) # _Chai Wah Wu_, Feb 01 2021

%Y Cf. A338231, A338233, A338234, A338236, A338430, A338434.

%K nonn,easy

%O 1,3

%A _Wesley Ivan Hurt_, Jan 30 2021