login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A139709 Take n in binary. Rotate the binary digits to the left until a 1 once again appears as the leftmost digit. a(n) is result written in binary. 3

%I

%S 1,10,11,100,110,101,111,1000,1100,1010,1110,1001,1011,1101,1111,

%T 10000,11000,10100,11100,10010,10110,11010,11110,10001,10011,10101,

%U 10111,11001,11011,11101,11111,100000,110000,101000,111000,100100,101100

%N Take n in binary. Rotate the binary digits to the left until a 1 once again appears as the leftmost digit. a(n) is result written in binary.

%C This sequence written in decimal is A139708.

%H Michael De Vlieger, <a href="/A139709/b139709.txt">Table of n, a(n) for n = 1..10000</a>

%e For n = 11 (in decimal): 11 (in decimal) = 1011 in binary. Rotate once to the left, getting 0111. The leftmost digit is a 0, so rotate again to the left, getting 1110. A 1 is the leftmost digit, so stop here. a(n) therefore is 1110 (which is 14 in decimal).

%p A007088 := proc(L) local i ; add(op(i,L)*10^(i-1),i=1..nops(L)) : end: A139709 := proc(n) local a; a := ListTools[Rotate](convert(n,base,2),-1) ; while op(-1,a) = 0 do a := ListTools[Rotate](a,-1) ; od: A007088(a) ; end: seq(A139709(n),n=1..80) ; # _R. J. Mathar_, May 04 2008

%t Array[FromDigits@ NestWhile[RotateLeft, IntegerDigits[#, 2], First@ # == 0 &, {2, 1}] &, 37] (* _Michael De Vlieger_, Oct 22 2017 *)

%o (PARI) rot(n) = if(#Str(n)==1, v=vector(1), v=vector(#n-1)); for(i=2, #n, v[i-1]=n[i]); u=vector(#n); for(i=1, #n, u[i]=n[i]); v=concat(v, u[1]); v

%o a(n) = my(b=rot(binary(n))); while(b[1]==0, b=rot(b)); subst(Pol(b), x, 10) \\ _Felix Fröhlich_, Oct 22 2017

%Y Cf. A139707, A139708.

%K nonn,base

%O 1,2

%A _Leroy Quet_, Apr 30 2008

%E More terms from _R. J. Mathar_, May 04 2008

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 16 06:46 EDT 2019. Contains 324145 sequences. (Running on oeis4.)