A343600 For any positive number n, the ternary representation of a(n) is obtained by left-rotating the ternary representation of n until a nonzero digit appears again as the leftmost digit; a(0) = 0.
0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 12, 21, 10, 13, 16, 19, 22, 25, 18, 15, 24, 11, 14, 17, 20, 23, 26, 27, 36, 63, 30, 39, 48, 57, 66, 75, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 54, 45, 72, 33, 42, 51, 60, 69, 78, 29, 32, 35, 38, 41
Offset: 0
Examples
The first terms, in base 10 and in base 3, 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 12 101 110 11 21 102 210 12 10 110 101 13 13 111 111 14 16 112 121
Links
Programs
-
PARI
a(n, base=3) = { my (d=digits(n, base)); for (k=2, #d, if (d[k], return (fromdigits(concat(d[k..#d], d[1..k-1]), base)))); n }
Comments