### Combining the 5x+1 and 3x+1 mappings

The two mappings $$T_1:\mathbb{Z}\to\mathbb{Z}$$ and $$T_2:\mathbb{Z}\to\mathbb{Z}$$: \begin{align*} T_1(x)&=\left\{\begin{array}{cc} x/2 & \mbox{ if $$x$$ is even}\\ (3x+1)/2 & \mbox{ if $$x$$ is odd} \end{array} \right.\\ \\ T_2(x)&=\left\{\begin{array}{cc} x/2 & \mbox{ if $$x$$ is even}\\ (5x+1)/2 & \mbox{ if $$x$$ is odd} \end{array} \right. \end{align*} are well-known: For $$n\neq0$$, the iterates $$n, T_1(n), T_1^2(n),\ldots$$ are conjectured to end up in one of the cycles $\small \{1,2\}, \{-1\}, \{-5,-7,-10\}, \{-17,-25,-37,-55,-82,-41,-61,-91,-136,-68,-34\};$ whereas the iterates $$n, T_2(n), T_2^2(n),\ldots$$ are conjectured to end up either in one of the cycles $\small \{-1, -2\}, \{1, 3, 8, 4, 2\}, \{13, 33, 83, 208, 104, 52, 26\}, \{17, 43, 108, 54, 27, 68, 34\}$ or diverge to $$\pm\infty$$ (e.g. $$n = 7, -9$$).

The two-branched mappings $$T_1$$ and $$T_2$$ can be combined to give two four-branched mappings: \begin{align*} T_2T_1(x)&=\left\{\begin{array}{cc} x/4 & \mbox{ if $$x\equiv 0\pmod{4}$$}\\ (3x+1)/4 & \mbox{ if $$x\equiv 1\pmod{4}$$}\\ (5x+2)/4 & \mbox{ if $$x\equiv 2\pmod{4}$$}\\ (15x+7)/4 & \mbox{ if $$x\equiv 3\pmod{4}$$} \end{array} \right.\\ \\ T_1T_2(x)&=\left\{\begin{array}{cc} x/4 & \mbox{ if $$x\equiv 0\pmod{4}$$}\\ (15x+5)/4 & \mbox{ if $$x\equiv 1\pmod{4}$$}\\ (3x+2)/4 & \mbox{ if $$x\equiv 2\pmod{4}$$}\\ (5x+1)/4 & \mbox{ if $$x\equiv 3\pmod{4}.$$} \end{array} \right. \end{align*} These are examples of relatively-prime mappings (see Generalized 3x+1 functions and Markov matrices) where $$\displaystyle \prod_{i=0}^3(m_i/4) = 225/256 < 1$$.

Hence it is believed that the iterates of these functions eventually enter one of finitely many cycles.

We list the observed cycles and print the iterates and the number of steps taken to reach one of these cycles.

#### Cycles found for $$T_2T_1$$:

(i) 0
(ii) 1
(iii) 10, 13
(iv) 7, 28
(v) 514, 643, 2413, 1810, 2263, 8488, 2122, 2653, 1990, 2488, 622, 778, 973, 730, 913, 685 (length 16)
(vi) -2
(vii) -749, -2807, -2105, -7892, -1973, -7397, -27737, -104012, -26003,
-19502, -24377, -91412, -22853, -85697, -321362, -401702, -502127, -376595,
-282446, -353057, -1323962, -1654952, -413738, -517172, -129293, -484847,
-363635, -272726, -340907, -255680, -63920, -15980, -3995, -2996. (length 34)

#### Cycles found for $$T_1T_2$$:

(i) 0
(ii) 2
(iii) 5, 20
(iv) 11, 14
(v) 257, 965, 3620, 905, 3395, 4244, 1061, 3980, 995, 1244, 311, 389, 1460, 365, 1370, 1028 (length 16)
(vi) -1
(vii) -1123, -4210, -3157, -3946, -2959, -11095, -41605, -52006, -39004,
-9751, -36565, -45706, -34279, -128545, -160681, -200851, -753190, -564892,
-141223, -529585, -661981, -827476, -206869, -258586, -193939, -727270,
-545452, -136363, -511360, -127840, -31960, -7990, -5992, -1498. (length 34)

Enter y:
Mapping $$T_2T_1$$
Mapping $$T_1T_2$$