A321525 Left-rotate nonzero digits in ternary expansion of n and convert back to decimal.
0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 19, 12, 13, 16, 21, 22, 25, 18, 11, 20, 15, 14, 17, 24, 23, 26, 27, 28, 55, 30, 31, 34, 57, 58, 61, 36, 37, 46, 39, 40, 43, 48, 49, 52, 63, 64, 73, 66, 67, 70, 75, 76, 79, 54, 29, 56, 33, 32, 35, 60, 59, 62, 45, 38, 47, 42, 41
Offset: 0
Examples
The first terms, alongside the corresponding ternary representations, are: n a(n) ter(n) ter(a(n)) -- ---- ------ --------- 0 0 0 0 1 1 1 1 2 2 2 2 3 3 10 10 4 4 11 11 5 7 12 21 6 6 20 20 7 5 21 12 8 8 22 22 9 9 100 100 10 10 101 101 11 19 102 201 12 12 110 110 13 13 111 111 14 16 112 121 15 21 120 210 16 22 121 211 17 25 122 221
Links
Programs
-
PARI
a(n, base=3) = my (d=digits(n, base), t=select(sign, d), i=0); for (j=1, #d, if (d[j], d[j]=t[1+(i++%#t)])); fromdigits(d, base)
Formula
a(3 * n) = 3 * a(n).
Comments