login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A073137 Least number having in binary representation the same number of 0's and 1's as n. 5
0, 1, 2, 3, 4, 5, 5, 7, 8, 9, 9, 11, 9, 11, 11, 15, 16, 17, 17, 19, 17, 19, 19, 23, 17, 19, 19, 23, 19, 23, 23, 31, 32, 33, 33, 35, 33, 35, 35, 39, 33, 35, 35, 39, 35, 39, 39, 47, 33, 35, 35, 39, 35, 39, 39, 47, 35, 39, 39, 47, 39, 47, 47, 63, 64, 65, 65, 67, 65, 67, 67, 71, 65 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

A023416(a(n)) = A023416(n), A000120(a(n)) = A000120(n).

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

Index entries for sequences related to binary expansion of n

FORMULA

a(0)=0, for n>0: a(n) = if n=2^log2(n) then n else if n<(1+2^(log2(n)-1))*2 then a(n-2^(log2(n)-1))+2^(log2(n)-1) else a(n-2^log2(n))*2+1.

For n > 0: a(n) = (2^(A000120(n) - 1)) * (2^A023416(n) + 1) - 1. - Corrected by Michel Marcus, Nov 15 2013

EXAMPLE

a(20)=17, as 20='10100' and 17 is the smallest number having two 1's and three 0's: 17='10001', 18='10010', 20='10100' and 24='11000'.

MATHEMATICA

lnb[n_]:=Module[{sidn=Sort[IntegerDigits[n, 2]]}, FromDigits[Join[{1}, Most[ sidn]], 2]]; Join[{0}, Array[lnb, 80]] (* Harvey P. Dale, Aug 04 2014 *)

CROSSREFS

Cf. A007088, A073138, A000523, A073139, A073140, A073141.

Sequence in context: A306328 A225090 A162683 * A131233 A136623 A031218

Adjacent sequences:  A073134 A073135 A073136 * A073138 A073139 A073140

KEYWORD

nonn

AUTHOR

Reinhard Zumkeller, Jul 16 2002

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 18 10:56 EDT 2019. Contains 328147 sequences. (Running on oeis4.)