|
|
A350651
|
|
a(n) is the size of the orbit of n under repeated application of A350229 (the sum of a number and its balanced ternary digits).
|
|
0
|
|
|
1, 2, 1, 3, 2, 3, 1, 2, 1, 4, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 3, 2, 3, 1, 2, 1, 4, 3, 3, 2, 7, 1, 7, 6, 6, 5, 4, 4, 4, 3, 5, 3, 4, 3, 4, 1, 2, 1, 3, 2, 3, 1, 2, 1, 2, 1, 3, 2, 3, 1, 2, 1, 4, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 3, 2, 3, 1, 2, 1, 4, 3, 3, 2, 6, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
This sequence is well defined:
- for any w such that 3^w > 2*w + 2:
- let M(w) (resp. m(w)) be the number whose balanced ternary expansion
starts with "1T"
followed by w T's
followed by w 1's (resp. w T's),
- for any u in the interval m(w)..M(w), A350229(u) <= u <= M(w),
- also for any v < m(k), A350229(v) < m(k) + 2*w + 2 <= M(w),
- and the orbit of any number <= M(w) will be trapped in the interval 0..M(w),
- hence for any number n, we can find an appropriate w, so the orbit of n is bounded and eventually periodic (with a finite size), QED.
This sequence is unbounded.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = #{ A350229^k(n), k >= 0 } (where f^k corresponds to the k-th iterate of f).
|
|
EXAMPLE
|
For n = 9:
- the orbit of 9 contains the following values:
k v bter(v) ds(v)
- -- ------- -----
0 9 100 1
1 10 101 2
2 12 110 2
3 14 1TTT -2
4 12 110 2
- so a(9) = #{ 9, 10, 12, 14 } = 4.
|
|
MATHEMATICA
|
f[n_] := n + Total[If[First@ # == 0, Rest@ #, #] &[Prepend[IntegerDigits[n, 3], 0] //. {x___, y_, k_ /; k > 1, z___} :> {x, y + 1, k - 3, z}]]; Array[-1 + Length@ NestWhileList[f, #, UnsameQ, All] &, 105, 0] (* Michael De Vlieger, Jan 15 2022 *)
|
|
PROG
|
(PARI) b(n) = my (v=n, d); while (n, n=(n-d=[0, 1, -1][1+n%3])/3; v+=d); v
a(n) = my (s=[]); while (!setsearch(s, n), s=setunion(s, [n]); n=b(n)); #s
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|