OFFSET
0,11
COMMENTS
Or: Number of iterations of A329201 until a number is seen for the second time in the trajectory of n.
A329201 consists of subtracting from or adding to n, depending on whether it is even or odd, the number A040115(n) whose digits are the differences of adjacent digits of n.
The trajectory of all numbers < 8000 ends in a repdigit (A010785), which are fixed points of this map. Some larger numbers enter nontrivial cycles, cf. A329342. In both cases, some number(s) will appear infinitely often in the trajectory. This sequence gives the number of iterations until a value is repeated for the first time in the trajectory of n. This is also the size of n's orbit, i.e. the total number of distinct values that will occur.
If n is part of a cycle (n in A329342), a(n) gives the length of the cycle; in particular a(n) = 1 for fixed points.
For 11 <= n <= 99 the pattern ( 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2) of length 11 repeats. But the trajectory of those n with same a(n) does not always end in the corresponding repdigit.
FORMULA
EXAMPLE
For repdigits A010785 and in particular single-digit numbers, {0, 1, ..., 9, 11, 22, ...}, A329201(n) = n, so O(n) = {n} and a(n) = 1.
For others we have:
10 -> 11, so a(10) = #{10, 11} = 2.
12 -> 13 -> 11, so a(10) = #{12, 13, 11} = 2. Also 23 -> 24 -> 22, so a(23) = 3, and similarly for 34, 45, 56, 67 and 78. But 89 -> 90 -> 99, the next *larger* repdigit!
20 -> 18 -> 25 -> 28 -> 22, whence a(20) = 5. Similarly, 31 -> 29 -> 36 -> 39 -> 33, a(31) = 5, too. But 42 -> 40 -> 36 -> 39 -> 33 goes to the next *lower* repdigit, yet still has a(42) = 5.
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 11 2019
STATUS
approved