|
|
A353830
|
|
The positions of nonzero digits in the balanced ternary expansions of n and a(n) are the same, and the k-th rightmost nonzero digit in a(n) equals the product of the k rightmost nonzero digits in n.
|
|
4
|
|
|
0, 1, -4, 3, 4, 11, -12, -11, -10, 9, 10, -13, 12, 13, -34, 33, 34, 35, -36, -35, 32, -33, -32, 29, -30, -29, -28, 27, 28, -31, 30, 31, 38, -39, -38, -37, 36, 37, -40, 39, 40, 101, -102, -101, -100, 99, 100, -103, 102, 103, -106, 105, 106, 107, -108, -107, 104
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
This sequence can naturally be extended to negative integers; we then obtain a permutation of the integers (Z).
A number is a fixed point of this sequence iff it has no digit -1 in its balanced ternary expansion (A005836).
|
|
LINKS
|
|
|
FORMULA
|
a(3*n) = 3*a(n).
a(3*n + 1) = 3*a(n) + 1.
Sum_{k = 0..n} a(n) = 0 iff n belongs to A029858.
|
|
EXAMPLE
|
The first terms, in decimal and in balanced ternary, are:
n a(n) bter(n) bter(a(n))
-- ---- ------- ----------
0 0 0 0
1 1 1 1
2 -4 1T TT
3 3 10 10
4 4 11 11
5 11 1TT 11T
6 -12 1T0 TT0
7 -11 1T1 TT1
8 -10 10T T0T
9 9 100 100
10 10 101 101
11 -13 11T TTT
12 12 110 110
|
|
PROG
|
(PARI) a(n) = {
my (d=[], t, p=1);
while (n, d=concat(t=[0, 1, -1][1+n%3], d); n=(n-t)/3);
forstep (k=#d, 1, -1, if (d[k], d[k]=p*=d[k]));
fromdigits(d, 3);
}
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|