OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
MAPLE
q:= n-> (w-> w(n-w(n))=w(n))(k-> add(i, i=Bits[Split](k))):
select(q, [$0..300])[]; # Alois P. Heinz, May 24 2022
MATHEMATICA
w[n_] := DigitCount[n, 2, 1]; Select[Range[0, 300], w[# - w[#]] == w[#] &] (* Amiram Eldar, Apr 02 2022 *)
PROG
(Python)
def w(n): return bin(n).count("1")
def ok(n): wn = w(n); return w(n - wn) == wn
print([k for k in range(277) if ok(k)]) # Michael S. Branicky, Apr 02 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ctibor O. Zizka, Apr 02 2022
STATUS
approved