login
Sum of squares of odd primes dividing n.
6

%I #34 Jun 20 2022 04:21:54

%S 0,0,9,0,25,9,49,0,9,25,121,9,169,49,34,0,289,9,361,25,58,121,529,9,

%T 25,169,9,49,841,34,961,0,130,289,74,9,1369,361,178,25,1681,58,1849,

%U 121,34,529,2209,9,49,25,298,169,2809,9,146,49,370,841,3481,34,3721,961,58,0,194,130,4489,289,538,74,5041,9,5329,1369

%N Sum of squares of odd primes dividing n.

%H Antti Karttunen, <a href="/A005066/b005066.txt">Table of n, a(n) for n = 1..10000</a>

%F Additive with a(p^e) = 0 if p = 2, p^2 otherwise.

%F G.f.: Sum_{k>=2} prime(k)^2*x^prime(k)/(1 - x^prime(k)). - _Ilya Gutkovskiy_, Jan 04 2017

%F From _Antti Karttunen_, Jul 10 & 11 2017: (Start)

%F a(1) = 0; after which, for even n: a(n) = a(n/2), for odd n: a(n) = A020639(n)^2 + a(A028234(n)).

%F a(n) = A005063(A000265(n)).

%F a(n) = A005079(n) + A005083(n).

%F (End)

%t Table[Total[Select[Divisors[n],OddQ[#]&&PrimeQ[#]&]^2],{n,60}] (* _Harvey P. Dale_, May 02 2012 *)

%t Array[DivisorSum[#, #^2 &, And[PrimeQ@ #, OddQ@ #] &] &, 74] (* _Michael De Vlieger_, Jul 11 2017 *)

%t f[2, e_] := 0; f[p_, e_] := p^2; a[n_] := Plus @@ f @@@ FactorInteger[n]; a[1] = 0; Array[a, 100] (* _Amiram Eldar_, Jun 20 2022 *)

%o (PARI) a(n) = sumdiv(n, d, ((d%2) && isprime(d))*d^2); \\ _Michel Marcus_, Jan 04 2017

%o (Scheme) (define (A005066 n) (cond ((= 1 n) 0) ((even? n) (A005066 (/ n 2))) (else (+ (A000290 (A020639 n)) (A005066 (A028234 n)))))) ;; _Antti Karttunen_, Jul 10 2017

%o (Python)

%o from sympy import primefactors

%o def a(n): return sum(p**2 for p in primefactors(n) if p % 2)

%o print([a(n) for n in range(1, 101)]) # _Indranil Ghosh_, Jul 11 2017

%Y Cf. A000265, A000290, A005063, A005067, A005068, A005069, A005079, A005083, A020639, A028234.

%K nonn

%O 1,3

%A _N. J. A. Sloane_

%E More terms from _Antti Karttunen_, Jul 10 2017