cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A004756 Binary expansion starts 100.

Original entry on oeis.org

4, 8, 9, 16, 17, 18, 19, 32, 33, 34, 35, 36, 37, 38, 39, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
Offset: 1

Views

Author

Keywords

Examples

			18 in binary is 10010, so 18 is in sequence.
		

Crossrefs

Cf. A004754 (10), A004755 (11), A004757 (101), A004758 (110), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004756 n = a004756_list !! (n-1)
    a004756_list = 4 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004756_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Mathematica
    Select[Range[4, 153], Take[IntegerDigits[#, 2], 3] == {1, 0, 0} &] (* Michael De Vlieger, Aug 07 2016 *)
  • PARI
    a(n)=n+3*2^floor(log(n)/log(2))
    
  • Python
    def A004756(n): return n+(3<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 3*[n==0].
a(n) = n + 3 * 2^floor(log_2(n)) = A004755(n) + A053644(n).
a(2^m+k) = 2^(m+2) + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 07 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003