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

A243615
Numbers n whose digital sum equals the number of binary digits in its binary expansion.
5
1, 2, 13, 23, 33, 42, 51, 60, 70, 106, 115, 124, 134, 143, 152, 161, 170, 206, 215, 224, 233, 242, 251, 261, 270, 306, 315, 324, 333, 342, 351, 360, 405, 414, 423, 432, 441, 450, 504, 514, 523, 532, 541, 550, 604, 613, 622, 631, 640, 703, 712, 721, 730, 802, 811, 820
OFFSET
1,2
EXAMPLE
134 -> 1+3+4=8 134=10000110 -> Eight bits.
MATHEMATICA
Select[Range[10^3], Total@ IntegerDigits@ # == 1 + Floor@ Log2@ # &] (* Michael De Vlieger, Nov 05 2018 *)
Select[Range[1000], Total[IntegerDigits[#]]==IntegerLength[#, 2]&] (* Harvey P. Dale, May 30 2021 *)
PROG
(PARI) isok(n) = sumdigits(n) == #binary(n); \\ Michel Marcus, Jun 08 2014
CROSSREFS
Sequence in context: A118796 A234218 A171794 * A243617 A045389 A243621
KEYWORD
nonn,base
AUTHOR
Andreas Boe, Jun 07 2014
STATUS
approved