A060583 A ternary code related to the Tower of Hanoi.
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
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.
Links
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.
Comments