A348367 a(n) = w(n + w(n)), where w(n) is the binary weight of n, A000120(n).
1, 2, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 1, 2, 3, 2, 3, 2, 3, 3, 2, 3, 4, 3, 3, 4, 5, 5, 2, 2, 2, 2, 3, 2, 3, 3, 2, 3, 4, 3, 3, 4, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 4, 4, 4, 5, 5, 5, 1, 1, 2, 3, 3, 2, 3, 2, 3, 3, 2, 3, 4, 3, 3, 4, 5, 5, 3, 3, 3, 3, 3, 4, 5, 5, 4, 4, 4, 5, 5, 5, 2, 2, 3, 4, 4, 3, 3, 4, 5
Offset: 1
Examples
n = 5; a(5) = A000120(5 + A000120(5)) = 3.
Programs
-
Mathematica
h[n_] := DigitCount[n, 2, 1]; a[n_] := h[n + h[n]]; Array[a, 100] (* Amiram Eldar, Oct 15 2021 *)
-
PARI
a(n) = hammingweight(n + hammingweight(n)); \\ Michel Marcus, Oct 17 2021
-
Python
def h(n): return bin(n).count('1') def a(n): return h(n + h(n)) print([a(n) for n in range(1, 100)]) # Michael S. Branicky, Oct 15 2021