login
Number of primes == 2 mod 3 dividing n.
5

%I #28 Apr 14 2021 22:23:48

%S 0,1,0,1,1,1,0,1,0,2,1,1,0,1,1,1,1,1,0,2,0,2,1,1,1,1,0,1,1,2,0,1,1,2,

%T 1,1,0,1,0,2,1,1,0,2,1,2,1,1,0,2,1,1,1,1,2,1,0,2,1,2,0,1,0,1,1,2,0,2,

%U 1,2,1,1,0,1,1,1,1,1,0,2,0,2,1,1,2,1,1,2,1,2,0,2,0,2,1,1,0,1,1,2,1,2,0,1,1,2,1,1,0,3,0,1,1,1,2,2,0,2,1,2

%N Number of primes == 2 mod 3 dividing n.

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

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

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

%F a(1) = 0; for n > 1, floor((A020639(n) mod 3)/2) + a(A028234(n)).

%F a(n) = A001221(n) - A005088(n) - A079978(n).

%F (End)

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

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

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

%o (Python)

%o from sympy import primefactors

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

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

%Y Cf. A001221, A005074, A005088, A079978.

%K nonn

%O 1,10

%A _N. J. A. Sloane_

%E More terms from _Antti Karttunen_, Jul 10 2017