A072998 To get a(n), write n in balanced ternary notation (using only digits -1, 0, 1, -1), then change -1's to 0's, 0's to 1's, and 1's to 2's.
1, 2, 20, 21, 22, 200, 201, 202, 210, 211, 212, 220, 221, 222, 2000, 2001, 2002, 2010, 2011, 2012, 2020, 2021, 2022, 2100, 2101, 2102, 2110, 2111, 2112, 2120, 2121, 2122, 2200, 2201, 2202, 2210, 2211, 2212, 2220, 2221, 2222, 20000, 20001, 20002, 20010
Offset: 0
Examples
n balanced ternary a(n) ----------------------- 0........0...........1 1........1...........2 2......1,-1..........2,0 3.......1,0..........2,1 ... 11 in base 10 = 11_10 = {1,1,-1} in balanced ternary = 1*3^2 + 1*3^1 - 1*3^0. Add 111 to {1,1,-1} to get a(11) = 220.
Extensions
Corrected by Reinhard Zumkeller, Aug 18 2008
Edited by N. J. A. Sloane, Mar 31 2021