A035531 a(n) = A000120(n) + A001221(n) - 1.
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, 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, 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
Offset: 1
Links
- Antti Karttunen, Table of n, a(n) for n = 1..65537 (first 1000 terms from G. C. Greubel)
Programs
-
Maple
A035531 := proc(n) A000120(n)+A001221(n)-1 ; end proc: seq(A035531(n),n=1..100) ; # R. J. Mathar, Mar 12 2018
-
Mathematica
Table[DigitCount[n, 2, 1] + PrimeNu[n] - 1, {n, 1, 100}] (* G. C. Greubel, Apr 24 2017 *)
-
PARI
a(n) = hammingweight(n) + omega(n) - 1; \\ Michel Marcus, Apr 25 2017
-
Python
from sympy import primefactors def a(n): return 0 if n<2 else bin(n)[2:].count("1") + len(primefactors(n)) - 1 # Indranil Ghosh, Apr 25 2017
Formula
G.f.: Sum a(n) x^n = Sum A000120(p)*x^p/(1-x^p), p = prime.
Extensions
More terms from David W. Wilson.