login
A352785
Numbers k such that w(k - w(k)) = w(k), where w(k) is the binary weight of k, A000120(k).
1
0, 2, 5, 12, 14, 20, 22, 25, 27, 28, 36, 38, 41, 43, 44, 52, 57, 58, 68, 70, 73, 75, 76, 84, 89, 90, 100, 105, 106, 115, 120, 122, 125, 132, 134, 137, 139, 140, 148, 153, 154, 164, 169, 170, 179, 184, 186, 189, 196, 201, 202, 211, 216, 218, 221, 232, 234, 237, 241, 243, 249, 252, 254, 260, 262, 265, 267, 268, 276
OFFSET
1,2
LINKS
FORMULA
k : A000120(A011371(k)) = A000120(k); A352784(k) = A000120(k).
EXAMPLE
k = 20; A000120(20 - A000120(20)) = A000120(20), thus k = 20 is a term.
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