login
Binary expansion starts 11.
23

%I #61 Jul 13 2022 10:14:41

%S 3,6,7,12,13,14,15,24,25,26,27,28,29,30,31,48,49,50,51,52,53,54,55,56,

%T 57,58,59,60,61,62,63,96,97,98,99,100,101,102,103,104,105,106,107,108,

%U 109,110,111,112,113,114,115,116,117,118,119,120,121,122

%N Binary expansion starts 11.

%C 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

%H Kenny Lau, <a href="/A004755/b004755.txt">Table of n, a(n) for n = 1..16383</a> (first 1023 terms from T. D. Noe)

%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>

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

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

%F a(n) = 2n + A080079(n). - _Benoit Cloitre_, Feb 22 2003

%F G.f.: (1/(1+x)) * (1 + Sum_{k>=0, t=x^2^k} 2^k*(2t+t^2)/(1+t)).

%F a(n) = n + 2^(floor(log_2(n)) + 1) = n + A062383(n). - _Franklin T. Adams-Watters_, Oct 23 2006

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

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

%p a:= proc(n) n+2*2^floor(log(n)/log(2)) end: seq(a(n),n=1..60); # _Muniru A Asiru_, Oct 16 2018

%t Flatten[Table[FromDigits[#,2]&/@(Join[{1,1},#]&/@Tuples[{0,1},n]),{n,0,5}]] (* _Harvey P. Dale_, Feb 05 2015 *)

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

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

%o (Haskell)

%o import Data.List (transpose)

%o a004755 n = a004755_list !! (n-1)

%o a004755_list = 3 : concat (transpose [zs, map (+ 1) zs])

%o where zs = map (* 2) a004755_list

%o -- _Reinhard Zumkeller_, Dec 04 2015

%o (Python)

%o f = open('b004755.txt', 'w')

%o lo = 3

%o hi = 4

%o i = 1

%o while i<16384:

%o for x in range(lo,hi):

%o f.write(str(i)+" "+str(x)+"\n")

%o i += 1

%o lo <<= 1

%o hi <<= 1

%o # _Kenny Lau_, Jul 05 2016

%o (Python)

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

%Y Equals union of A079946 and A080565.

%Y Cf. A004754 (10), A004756 (100), A004757 (101), A004758 (110), A004759 (111).

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

%K nonn,base,easy

%O 1,1

%A _N. J. A. Sloane_

%E Edited by _Ralf Stephan_, Oct 12 2003