A353824 The positions of nonzero digits in the ternary expansions of n and a(n) are the same, and the k-th leftmost nonzero digit in a(n) equals modulo 3 the product of the k leftmost nonzero digits in n.
0, 1, 2, 3, 4, 5, 6, 8, 7, 9, 10, 11, 12, 13, 14, 15, 17, 16, 18, 20, 19, 24, 26, 25, 21, 22, 23, 27, 28, 29, 30, 31, 32, 33, 35, 34, 36, 37, 38, 39, 40, 41, 42, 44, 43, 45, 47, 46, 51, 53, 52, 48, 49, 50, 54, 56, 55, 60, 62, 61, 57, 58, 59, 72, 74, 73, 78, 80
Offset: 0
Examples
The first terms, in decimal and in ternary, 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 5 12 12 6 6 20 20 7 8 21 22 8 7 22 21 9 9 100 100 10 10 101 101 11 11 102 102 12 12 110 110
Links
Programs
-
PARI
a(n) = { my (d=digits(n,3), p=1); for (k=1, #d, if (d[k], d[k]=p*=d[k])); fromdigits(d%3,3) }
Formula
a(3*n) = 3*a(n).
Comments