login
Sum of squares of primes = 2 mod 3 dividing n.
5

%I #21 Jun 21 2022 05:10:45

%S 0,4,0,4,25,4,0,4,0,29,121,4,0,4,25,4,289,4,0,29,0,125,529,4,25,4,0,4,

%T 841,29,0,4,121,293,25,4,0,4,0,29,1681,4,0,125,25,533,2209,4,0,29,289,

%U 4,2809,4,146,4,0,845,3481,29,0,4,0,4,25,125,0,293,529,29,5041,4,0,4,25,4,121,4,0,29,0,1685,6889,4,314

%N Sum of squares of primes = 2 mod 3 dividing n.

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

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

%F a(n) = A005063(n) - A005071(n) - 9*A079978(n). - _Antti Karttunen_, Jul 10 2017

%t Array[DivisorSum[#, #^2 &, And[PrimeQ@ #, Mod[#, 3] == 2] &] &, 85] (* _Michael De Vlieger_, Jul 11 2017 *)

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

%o (Scheme) (define (A005075 n) (if (= 1 n) 0 (+ (A000290 (if (= 2 (modulo (A020639 n) 3)) (A020639 n) 0)) (A005075 (A028234 n))))) ;; _Antti Karttunen_, Jul 10 2017

%o (PARI) a(n) = my(f=factor(n)); sum(k=1, #f~, if (((p=f[k,1])%3) == 2, p^2)); \\ _Michel Marcus_, Jul 11 2017

%Y Cf. A000290, A005063, A005071, A005074, A005076, A005077, A008472, A079978.

%K nonn

%O 1,2

%A _N. J. A. Sloane_

%E More terms from _Antti Karttunen_, Jul 10 2017