cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A329340 Size of the orbit of n under "ghost iterations" A329201 (rule B).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 2, 3, 2, 3, 2, 4, 2, 5, 2, 1, 3, 4, 3, 6, 3, 5, 3, 5, 3, 5, 2, 1, 3, 2, 3, 2, 5, 2, 9, 2, 4
Offset: 0

Views

Author

M. F. Hasler, Nov 11 2019

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A329201, A329197 (analog for A329200), A329342 (list of cycles), A329341 (length of cycles), A329196, A329197 (cycles for A329200).

Programs

  • PARI
    apply( A329340(n,M=oo,U=[n])={for(k=1,M,setsearch(U,n=A329201(n))&&return(k); U=setunion(U,[n]))}, [0..122])

Formula

a(n) = 1 <=> n is a fixed point of A329201 <=> n is a repdigit number (A010785).
a(n) = a(n') if 11 <= n, n' <= 99 and n == n' (mod 11).
a(n) = # orbit(n) where orbit(n) = { (A329201^k)(n); k >= 0 }.