%I #26 Sep 25 2022 04:26:14
%S 1,2,1,3,1,2,1,4,2,2,1,3,1,2,1,5,1,4,1,3,1,2,1,4,2,2,2,3,1,2,1,6,1,2,
%T 1,6,1,2,1,4,1,2,1,3,2,2,1,5,2,4,1,3,1,4,1,4,1,2,1,3,1,2,2,7,1,2,1,3,
%U 1,2,1,8,1,2,2,3,1,2,1,5,3,2,1,3,1,2,1,4,1,4,1,3,1,2,1,6,1,4,2,6,1,2,1,4,1
%N Number of squares or twice squares dividing n.
%H Carl R. White, <a href="/A065704/b065704.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = (1/2)*Sum_{ d divides n } (1-(-1)^sigma(d)).
%F Multiplicative with a(2^e) = e+1 and a(p^e) = floor(e/2)+1 for an odd prime p.
%F a(n) = A005361(2*n) for n>0 (conjectured). - _Werner Schulte_, Jan 15 2018 [This is true only for numbers whose odd part (A000265) is cubefree (A004709). Therefore, the least counterexample is n=3^3=27: a(27) = 2 while A005361(2*27) = 3. - _Amiram Eldar_, Sep 25 2022]
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi^2/4 (A091476). - _Amiram Eldar_, Sep 25 2022
%e divisors(36) = {1, 2, 3, 4, 6, 9, 12, 18, 36}, thus a(36) = #{1, 2, 4, 9, 18, 36}=6. a(36) = 1/2*(tau(36)-((-1)^sigma(1)+(-1)^sigma(2)+(-1)^sigma(3)+(-1)^sigma(4)+(-1)^sigma(6)+(-1)^sigma(9)+(-1)^sigma(12)+(-1)^sigma(18)+(-1)^sigma(36))) = 1/2*(9-(-3)) = 6. a(36) = a(2^2*3^2) = a(2^2)*a(3^2) = (2+1)*(1+1) = 6.
%t f[n_] := Total[1 - (-1)^DivisorSigma[1, Divisors@n]]/2; Array[f, 105] (* _Robert G. Wilson v_, Jan 02 2013 *)
%t f[p_, e_] := If[p == 2, e+1, Floor[e/2] + 1]; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 25 2022 *)
%o (PARI) a(n) = {my(e = valuation(n, 2), o = n>>e, f = factor(o)); (e+1)*prod(i=1 , #f~, floor(f[i,2]/2)+1)}; \\ _Amiram Eldar_, Sep 25 2022
%Y Cf. A000203, A028982, A046951, A091476.
%Y Cf. A000265, A004709.
%K mult,nonn
%O 1,2
%A _Vladeta Jovovic_, Dec 04 2001
%E More terms from _David Wasserman_, Sep 09 2002