OFFSET
0,3
COMMENTS
Optimal for moving an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1.
FORMULA
a(n) = Sum_{j=0..floor(log_2(n))} 10^j * (floor((n/2^j + 1)/2)*(-1)^j mod 3).
MATHEMATICA
a[n_]:=Sum[10^j*(Mod[(-1)^j*Floor[(n/2^j + 1)/2], 3]), {j, 0, Floor[Log2[n]]}]; Array[a, 70, 0] (* Stefano Spezia, Oct 27 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Henry Bottomley, Jun 06 2000
STATUS
approved