login
a(n) = Sum_{ x <= n : omega(x) = 2 } x.
2

%I #17 Aug 23 2021 18:36:21

%S 0,0,0,0,0,6,6,6,6,16,16,28,28,42,57,57,57,75,75,95,116,138,138,162,

%T 162,188,188,216,216,216,216,216,249,283,318,354,354,392,431,471,471,

%U 471,471,515,560,606,606,654,654,704,755,807,807,861,916,972,1029,1087,1087,1087

%N a(n) = Sum_{ x <= n : omega(x) = 2 } x.

%H Alois P. Heinz, <a href="/A346621/b346621.txt">Table of n, a(n) for n = 1..20000</a>

%p a:= proc(n) option remember; `if`(n=0, 0,

%p a(n-1)+`if`(nops(ifactors(n)[2])=2, n, 0))

%p end:

%p seq(a(n), n=1..60); # _Alois P. Heinz_, Aug 23 2021

%o (PARI) a(n) = sum(x=1, n, if (omega(x)==2, x)); \\ _Michel Marcus_, Aug 23 2021

%o (Python)

%o from sympy import primefactors

%o def A346621(n):

%o return 0 if n <= 2 else A346621(n-1) + (n if len(primefactors(n)) == 2 else 0) # _Chai Wah Wu_, Aug 23 2021

%Y Cf. A001221, A007774, A082997, A346622, A346623.

%K nonn

%O 1,6

%A _N. J. A. Sloane_, Aug 23 2021