login
a(n) = w(n + w(n)), where w(n) is the binary weight of n, A000120(n).
3

%I #15 Oct 19 2021 10:59:48

%S 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,

%T 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,

%U 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

%N a(n) = w(n + w(n)), where w(n) is the binary weight of n, A000120(n).

%F a(n) = A000120(n + A000120(n)); a(n) = A000120(A092391(n)).

%e n = 5; a(5) = A000120(5 + A000120(5)) = 3.

%t h[n_] := DigitCount[n, 2, 1]; a[n_] := h[n + h[n]]; Array[a, 100] (* _Amiram Eldar_, Oct 15 2021 *)

%o (Python)

%o def h(n): return bin(n).count('1')

%o def a(n): return h(n + h(n))

%o print([a(n) for n in range(1, 100)]) # _Michael S. Branicky_, Oct 15 2021

%o (PARI) a(n) = hammingweight(n + hammingweight(n)); \\ _Michel Marcus_, Oct 17 2021

%Y Cf. A000120, A092391.

%K nonn,base

%O 1,2

%A _Ctibor O. Zizka_, Oct 15 2021