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.

A004755 Binary expansion starts 11.

Original entry on oeis.org

3, 6, 7, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122
Offset: 1

Views

Author

Keywords

Comments

a(n) is the smallest value > a(n-1) (or > 1 for n=1) for which A001511(a(n)) = A001511(n). - Franklin T. Adams-Watters, Oct 23 2006

Examples

			12 in binary is 1100, so 12 is in the sequence.
		

Crossrefs

Equals union of A079946 and A080565.
Cf. A004754 (10), A004756 (100), A004757 (101), A004758 (110), A004759 (111).

Programs

  • Haskell
    import Data.List (transpose)
    a004755 n = a004755_list !! (n-1)
    a004755_list = 3 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004755_list
    -- Reinhard Zumkeller, Dec 04 2015
    
  • Maple
    a:= proc(n) n+2*2^floor(log(n)/log(2)) end: seq(a(n),n=1..60); # Muniru A Asiru, Oct 16 2018
  • Mathematica
    Flatten[Table[FromDigits[#,2]&/@(Join[{1,1},#]&/@Tuples[{0,1},n]),{n,0,5}]] (* Harvey P. Dale, Feb 05 2015 *)
  • PARI
    a(n)=n+2*2^floor(log(n)/log(2))
    
  • PARI
    is(n)=n>2 && binary(n)[2] \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    f = open('b004755.txt', 'w')
    lo = 3
    hi = 4
    i = 1
    while i<16384:
        for x in range(lo,hi):
            f.write(str(i)+" "+str(x)+"\n")
            i += 1
        lo <<= 1
        hi <<= 1
    # Kenny Lau, Jul 05 2016
    
  • Python
    def A004755(n): return n+(1<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1 + 2*[n==0].
a(n) = n + 2 * 2^floor(log_2(n)) = A004754(n) + A053644(n).
a(n) = 2n + A080079(n). - Benoit Cloitre, Feb 22 2003
G.f.: (1/(1+x)) * (1 + Sum_{k>=0, t=x^2^k} 2^k*(2t+t^2)/(1+t)).
a(n) = n + 2^(floor(log_2(n)) + 1) = n + A062383(n). - Franklin T. Adams-Watters, Oct 23 2006
a(2^m+k) = 2^(m+1) + 2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003