login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

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 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004758 Binary expansion starts 110. 10
6, 12, 13, 24, 25, 26, 27, 48, 49, 50, 51, 52, 53, 54, 55, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..4095

FORMULA

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 5*[n==0].

a(n) = n + 5 * 2^floor(log_2(n)) = A004757(n) + A053644(n).

a(2^m+k) = 6*2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

EXAMPLE

26 in binary is 11010, so 26 is in sequence.

MATHEMATICA

w = {1, 1, 0}; Select[Range[5, 213], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* or *)

Table[n + 5*2^Floor@ Log2@ n, {n, 53}] (* Michael De Vlieger, Aug 10 2016 *)

PROG

(PARI) a(n)=n+5*2^floor(log(n)/log(2))

(Haskell)

import Data.List (transpose)

a004758 n = a004758_list !! (n-1)

a004758_list = 6 : concat (transpose [zs, map (+ 1) zs])

where zs = map (* 2) a004758_list

-- Reinhard Zumkeller, Dec 03 2015

(Python)

def A004758(n): return n+(5<<n.bit_length()-1) # Chai Wah Wu, Jul 13 2022

CROSSREFS

Cf. A004754 (10), A004755 (11), A004756 (100), A004757 (101), A004759 (111).

Cf. A004760, A053644, A062050, A076877.

Sequence in context: A297258 A296702 A297135 * A055051 A338054 A336559

Adjacent sequences: A004755 A004756 A004757 * A004759 A004760 A004761

KEYWORD

nonn,base,easy

AUTHOR

N. J. A. Sloane

EXTENSIONS

Edited by Ralf Stephan, Oct 12 2003

STATUS

approved

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 December 9 19:36 EST 2022. Contains 358703 sequences. (Running on oeis4.)