login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A352784
a(n) = w(n - w(n)), where w(n) is the binary weight of n, A000120(n).
2
0, 0, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 5, 5, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 4, 4, 5, 5, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 4, 4, 6, 6, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 4, 4, 5, 5, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 4, 4, 5, 5, 6, 6, 3, 3, 3, 3, 4, 4, 4, 4
OFFSET
0,5
LINKS
FORMULA
a(n) = A000120(n - A000120(n)); a(n) = A000120(A011371(n)).
a(n) = A280700(floor(n/2)). - Georg Fischer, Nov 29 2022
EXAMPLE
a(8) = A000120(8 - A000120(8)) = 3.
MAPLE
a:= n-> (w-> w(n-w(n)))(k-> add(i, i=Bits[Split](k))):
seq(a(n), n=0..120); # Alois P. Heinz, May 24 2022
MATHEMATICA
w[n_] := DigitCount[n, 2, 1]; a[n_] := w[n - w[n]]; Array[a, 100, 0] (* Amiram Eldar, Apr 02 2022 *)
PROG
(Python)
def w(n): return bin(n).count("1")
def a(n): return w(n - w(n))
print([a(n) for n in range(108)]) # Michael S. Branicky, Apr 02 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ctibor O. Zizka, Apr 02 2022
STATUS
approved