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”).

Numbers k such that w(k + w(k)) = w(k), where w(k) is the binary weight of k, A000120(k).
0

%I #22 Apr 03 2022 09:56:47

%S 0,1,3,10,11,18,19,22,23,25,34,35,38,39,41,49,53,54,66,67,70,71,73,81,

%T 85,86,97,101,102,110,116,117,119,130,131,134,135,137,145,149,150,161,

%U 165,166,174,180,181,183,193,197,198,206,212,213,215,228,229,231,236,237,243,246,247,258,259,262,263,265,273

%N Numbers k such that w(k + w(k)) = w(k), where w(k) is the binary weight of k, A000120(k).

%C w(k + w(k)) - w(k) = 0 this sequence, w(k + w(k)) - w(k) = 2 for k = 4*j, where A000120(j) = 3.

%F k : A000120(A092391(k)) = A000120(k); A348367(k) = A000120(k).

%e k = 18; A000120(18 + A000120(18)) = A000120(18), thus k = 18 is a term.

%t w[n_] := DigitCount[n, 2, 1]; Select[Range[0, 300], w[# + w[#]] == w[#] &] (* _Amiram Eldar_, Apr 02 2022 *)

%o (Python)

%o def w(n): return bin(n).count("1")

%o def ok(n): wn = w(n); return w(n + wn) == wn

%o print([k for k in range(274) if ok(k)]) # _Michael S. Branicky_, Apr 02 2022

%Y Cf. A000120, A092391, A348367.

%K nonn,base,easy

%O 1,3

%A _Ctibor O. Zizka_, Apr 02 2022