OFFSET
1,2
COMMENTS
This sequence written in decimal is A139708.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
EXAMPLE
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(11) therefore is 1110 (which is 14 in decimal).
MAPLE
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
MATHEMATICA
Array[FromDigits@ NestWhile[RotateLeft, IntegerDigits[#, 2], First@ # == 0 &, {2, 1}] &, 37] (* Michael De Vlieger, Oct 22 2017 *)
PROG
(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
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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Leroy Quet, Apr 30 2008
EXTENSIONS
More terms from R. J. Mathar, May 04 2008
STATUS
approved