login
a(n) = A000120(n) + A001221(n) - 1.
3

%I #22 Sep 06 2023 21:13:05

%S 0,1,2,1,2,3,3,1,2,3,3,3,3,4,5,1,2,3,3,3,4,4,4,3,3,4,4,4,4,6,5,1,3,3,

%T 4,3,3,4,5,3,3,5,4,4,5,5,5,3,3,4,5,4,4,5,6,4,5,5,5,6,5,6,7,1,3,4,3,3,

%U 4,5,4,3,3,4,5,4,5,6,5,3,3,4,4,5,5,5,6,4,4,6,6,5,6,6,7,3,3,4,5,4,4,6,5,4,6,5,5,5,5,7,7

%N a(n) = A000120(n) + A001221(n) - 1.

%H Antti Karttunen, <a href="/A035531/b035531.txt">Table of n, a(n) for n = 1..65537</a> (first 1000 terms from G. C. Greubel)

%F G.f.: Sum a(n) x^n = Sum A000120(p)*x^p/(1-x^p), p = prime.

%p A035531 := proc(n)

%p A000120(n)+A001221(n)-1 ;

%p end proc:

%p seq(A035531(n),n=1..100) ; # _R. J. Mathar_, Mar 12 2018

%t Table[DigitCount[n, 2, 1] + PrimeNu[n] - 1, {n, 1, 100}] (* _G. C. Greubel_, Apr 24 2017 *)

%o (PARI) a(n) = hammingweight(n) + omega(n) - 1; \\ _Michel Marcus_, Apr 25 2017

%o (Python)

%o from sympy import primefactors

%o def a(n): return 0 if n<2 else bin(n)[2:].count("1") + len(primefactors(n)) - 1 # _Indranil Ghosh_, Apr 25 2017

%Y Cf. A000120, A001221.

%Y Cf. also A336149.

%K nonn,easy

%O 1,3

%A _Daniele Parisse_

%E More terms from _David W. Wilson_.