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-4 of 4 results.

A060583 A ternary code related to the Tower of Hanoi.

Original entry on oeis.org

0, 2, 1, 7, 6, 8, 5, 4, 3, 23, 22, 21, 18, 20, 19, 25, 24, 26, 16, 15, 17, 14, 13, 12, 9, 11, 10, 70, 69, 71, 68, 67, 66, 63, 65, 64, 54, 56, 55, 61, 60, 62, 59, 58, 57, 77, 76, 75, 72, 74, 73, 79, 78, 80, 50, 49, 48, 45, 47, 46, 52, 51, 53, 43, 42, 44, 41, 40, 39, 36, 38, 37
Offset: 0

Views

Author

Henry Bottomley, Apr 04 2001

Keywords

Comments

Write n in base 3, then (working from left to right) if the k-th digit of n is equal to the corresponding digit to the left of the k-th digit of a(n) then this is the k-th digit of a(n), otherwise the k-th digit of a(n) is the element of {0,1,2} which has not just been compared, then read result as a base 3 number.

Examples

			a(46) = 76 since 43 = 1201_3; this gives a first digit of 2(=3-1-0), a second digit of 2(=2=2), a third digit of 1(=3-2-0) and a fourth digit of 1(=1=1); 2211_3 = 76.
		

Crossrefs

Cf. A060586, A060587 (inverse).

Formula

a(n) = 3*a(floor(n/3)) + ((-a(floor(n/3))-n) mod 3) = 3*a(floor(n/3)) + A060582(n) with a(0)=0.

A060590 Numerator of the expected time to finish a random Tower of Hanoi problem with n disks using optimal moves.

Original entry on oeis.org

0, 2, 2, 14, 10, 62, 42, 254, 170, 1022, 682, 4094, 2730, 16382, 10922, 65534, 43690, 262142, 174762, 1048574, 699050, 4194302, 2796202, 16777214, 11184810, 67108862, 44739242, 268435454, 178956970, 1073741822, 715827882, 4294967294
Offset: 0

Views

Author

Henry Bottomley, Apr 05 2001

Keywords

Examples

			a(2)=2 since there are nine equally likely possibilities, with times required of 0,1,1,2,2,3,3,3,3 giving an average of 18/9 = 2/1.
		

Crossrefs

Denominator is A010684(n). Cf. A007798, A060586, A060589, A020988 (even bisection).

Programs

  • PARI
    a(n)={2*(2^n - 1)*(2 - (-1)^n)/3} \\ Harry J. Smith, Jul 07 2009

Formula

a(n) = 2*(2^n - 1)*(2 - (-1)^n)/3.
a(2n) = A020988(n-1).
From Ralf Stephan, Mar 07 2003: (Start)
G.f.: (4*x^3+2*x^2+2*x)/(4*x^4-5*x^2+1).
a(n+4) = 5*a(n+2) - 4*a(n). (End)

A060589 a(n) = 2*(2^n-1)*3^(n-1).

Original entry on oeis.org

0, 2, 18, 126, 810, 5022, 30618, 185166, 1115370, 6705342, 40271418, 241746606, 1450833930, 8706066462, 52239587418, 313447090446, 1880711240490, 11284353536382, 67706379498618, 406239051832686, 2437436635519050, 14624626786683102, 87747781640805018
Offset: 0

Views

Author

Henry Bottomley, Apr 05 2001

Keywords

Comments

a(n)/3^n is the expected time to finish a random Tower of Hanoi problem with n disks using optimal moves.

Crossrefs

Programs

  • Magma
    [2*(2^n - 1)*3^(n - 1): n in [0..30]]; // Vincenzo Librandi, Jul 03 2018
  • Mathematica
    Table[2 (2^n - 1) 3^(n - 1), {n, 0, 50}] (* or *) LinearRecurrence[{9, -18}, {0, 2}, 40] (* Vincenzo Librandi, Jul 03 2018 *)
  • PARI
    a(n)={2*(2^n - 1)*3^(n - 1)} \\ Harry J. Smith, Jul 07 2009
    

Formula

a(n) = Sum_{j<2^n} j*A001316(j) = 6*a(n-1) + A008776(n-1) = 4*A000400(n-1) - A008776(n-1) = A000244(n)*A060590(n)/A010684(n).
G.f.: 2*x/((3*x-1)*(6*x-1)). [Colin Barker, Dec 26 2012]

Extensions

Corrected by T. D. Noe, Nov 07 2006

A060585 Write n in base 3, then (working from left to right) if the k-th digit of n is not equal to the digit to its left then the k-th digit of a(n) is 1, otherwise it is 0, and finally read the result as a base-2 number.

Original entry on oeis.org

0, 1, 1, 3, 2, 3, 3, 3, 2, 6, 7, 7, 5, 4, 5, 7, 7, 6, 6, 7, 7, 7, 6, 7, 5, 5, 4, 12, 13, 13, 15, 14, 15, 15, 15, 14, 10, 11, 11, 9, 8, 9, 11, 11, 10, 14, 15, 15, 15, 14, 15, 13, 13, 12, 12, 13, 13, 15, 14, 15, 15, 15, 14, 14, 15, 15, 13, 12, 13, 15, 15, 14, 10, 11, 11, 11, 10, 11, 9, 9
Offset: 0

Views

Author

Henry Bottomley, Apr 04 2001

Keywords

Comments

A ternary-to-binary map.
Each k appears A001316(k) times in the sequence.

Examples

			a(76) = 10 since 76 = 2211_3 and looking for changing digits produces 1010 which, read as if in binary, is 10.
		

Crossrefs

Programs

  • PARI
    a(n) = my(v=digits(n,3)); if(#v, forstep(k=#v,2,-1, v[k]=(v[k]!=v[k-1])); v[1]=1); fromdigits(v,2); \\ Kevin Ryde, Apr 15 2021

Formula

a(n) = 2*a(floor(n/3)) + A060584(n) = A060586(A060587(n)).

Extensions

Definition rewritten by Editors of OEIS, Apr 15 2021.
Showing 1-4 of 4 results.