OFFSET
0,5
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
FORMULA
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