A128202 Configuration of discs on pegs after n steps of the optimal solution to the Towers of Hanoi problem moving an odd number of discs from peg 0 to peg 2, or an even number from peg 0 to peg 1.
0, 2, 5, 4, 22, 21, 24, 26, 53, 52, 46, 45, 36, 38, 41, 40, 202, 201, 204, 206, 197, 196, 190, 189, 216, 218, 221, 220, 238, 237, 240, 242, 485, 484, 478, 477, 468, 470, 473, 472, 418, 417, 420, 422, 413, 412, 406, 405, 324, 326, 329, 328, 346, 345, 348, 350
Offset: 1
Links
- Zoran Šunić, Tree morphisms, transducers and integer sequences, arXiv:math/0612080 [math.CO], 2006, see after proposition 5.4.
- Index entries for sequences related to Towers of Hanoi
Programs
-
PARI
a(n) = my(v=binary(bitxor(n,n>>1)),s=(-1)^#v,d=0); for(i=1,#v, if(v[i],d=(d+s)%3,s=-s); v[i]=d); fromdigits(v,3); \\ Kevin Ryde, Oct 21 2021
Extensions
Name and data corrected and extended by Kevin Ryde, Oct 21 2021
Comments