The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004754 Numbers n whose binary expansion starts 10. 30

%I #35 Jul 13 2022 20:37:29

%S 2,4,5,8,9,10,11,16,17,18,19,20,21,22,23,32,33,34,35,36,37,38,39,40,

%T 41,42,43,44,45,46,47,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,

%U 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,128,129,130,131

%N Numbers n whose binary expansion starts 10.

%C A000120(a(n)) = A000120(n); A023416(a(n-1)) = A008687(n) for n > 1. - _Reinhard Zumkeller_, Dec 04 2015

%H T. D. Noe, <a href="/A004754/b004754.txt">Table of n, a(n) for n = 1..1023</a>

%H Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>

%H Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + [n==0].

%F a(n) = n + 2^floor(log_2(n)) = n + A053644(n).

%F a(2^m+k) = 2^(m+1) + k, m >= 0, 0 <= k < 2^m. - _Yosu Yurramendi_, Aug 08 2016

%e 10 in binary is 1010, so 10 is in sequence.

%t w = {1, 0}; Select[Range[2, 131], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* _Michael De Vlieger_, Aug 08 2016 *)

%o (PARI) a(n)=n+2^floor(log(n)/log(2))

%o (PARI) is(n)=n>1 && !binary(n)[2] \\ _Charles R Greathouse IV_, Sep 23 2012

%o (Haskell)

%o import Data.List (transpose)

%o a004754 n = a004754_list !! (n-1)

%o a004754_list = 2 : concat (transpose [zs, map (+ 1) zs])

%o where zs = map (* 2) a004754_list

%o -- _Reinhard Zumkeller_, Dec 04 2015

%o (Python)

%o def A004754(n): return n+(1<<n.bit_length()-1) # _Chai Wah Wu_, Jul 13 2022

%Y Cf. A123001 (binary version), A004755 (11), A004756 (100), A004757 (101), A004758 (110), A004759 (111).

%Y Cf. A004760, A053644, A062050, A076877.

%Y Apart from initial terms, same as A004761.

%Y Cf. A000120, A023416, A008687.

%K nonn,easy,base

%O 1,1

%A _N. J. A. Sloane_

%E Edited by _Ralf Stephan_, Oct 12 2003

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 22:00 EDT 2024. Contains 373134 sequences. (Running on oeis4.)