### Example 7 of G. Venturini

The iterates y, T(y), T(T(y)),... of the function

 T(x) = x/3 if x ≡ 0 (mod 6) T(x) = (2x - 2)/3 if x ≡ 1 (mod 6) T(x) = (5x - 4)/3 if x ≡ 2 (mod 6) T(x) = 4x/3 if x ≡ 3 (mod 6) T(x) = (5x - 8)/3 if x ≡ 3 (mod 6) T(x) = (4x - 2)/3 if x ≡ 5 (mod 6)

are printed and the number of steps taken to reach one of the integers 0, -2, 2, 4, -16, -26, -22, -32, 418 is recorded.

We conjecture that every trajectory will end in one of the cycles:

cycle 1: 0
cycle 2: -6, -2
cycle 3: 2
cycle 4: -16, -28, -48
cycle 5: 4
cycle 6: -78, -26, -46
cycle 7: -22, -38, -66
cycle 8: -32, -56, -96
cycle 9: 2454, 818, 1362, 454, 754, 1254, 418, 694, 1154, 1922, 3202, 5334, 1778, 2962, 4934, 8222, 13702, 22834, 38054, 63422, 105702, 35234, 58722, 19574, 32622, 10874, 18122, 30202, 50334, 16778, 27962, 46602, 15534, 5178, 1726, 2874, 958, 1594, 2654, 4422, 1474.

See G. Venturini, Iterates of Number Theoretic Functions with Periodic Rational Coefficients (Generalization of the 3x+1 Problem), Studies in Applied Mathematics, 86 (1992)185-218.

Enter M: