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.

Showing 1-2 of 2 results.

A139706 Take n in binary. Rotate the binary digits to the right until a 1 once again appears as the leftmost digit. Convert back into decimal for a(n).

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 7, 8, 12, 10, 13, 9, 14, 11, 15, 16, 24, 20, 25, 18, 26, 21, 27, 17, 28, 22, 29, 19, 30, 23, 31, 32, 48, 40, 49, 36, 50, 41, 51, 34, 52, 42, 53, 37, 54, 43, 55, 33, 56, 44, 57, 38, 58, 45, 59, 35, 60, 46, 61, 39, 62, 47, 63, 64, 96, 80, 97, 72, 98, 81, 99, 68
Offset: 1

Views

Author

Leroy Quet, Apr 30 2008

Keywords

Comments

This sequence written in binary is A139707.
This is a permutation of the positive integers. A139708 is the inverse permutation.
Moreover, the first 2^n terms are a permutation of the first 2^n positive integers. Fixed points of the permutation are A272919. - Ivan Neretin, May 10 2016

Crossrefs

Cf. A139707 (in binary), A139708 (inverse), A272919 (fixed points).

Programs

  • Maple
    A139706 := proc(n) local a; a := ListTools[Rotate](convert(n,base,2),1) ; while op(-1,a) = 0 do a := ListTools[Rotate](a,1) ; od: add(op(i,a)*2^(i-1),i=1..nops(a)) : end: seq(A139706(n),n=1..100) ; # R. J. Mathar, May 04 2008
  • Mathematica
    Table[FromDigits[RotateRight[IntegerDigits[n, 2], IntegerExponent[n, 2] + 1], 2], {n, 72}] (* Ivan Neretin, May 10 2016 *)

Extensions

More terms from R. J. Mathar, May 04 2008

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.

Original entry on oeis.org

1, 10, 11, 100, 110, 101, 111, 1000, 1100, 1010, 1110, 1001, 1011, 1101, 1111, 10000, 11000, 10100, 11100, 10010, 10110, 11010, 11110, 10001, 10011, 10101, 10111, 11001, 11011, 11101, 11111, 100000, 110000, 101000, 111000, 100100, 101100
Offset: 1

Views

Author

Leroy Quet, Apr 30 2008

Keywords

Comments

This sequence written in decimal is A139708.

Examples

			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).
		

Crossrefs

Programs

  • 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 *)
  • 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

Extensions

More terms from R. J. Mathar, May 04 2008
Showing 1-2 of 2 results.