### Blanton C. Wiggin's generalization of the 3x+1 mapping

The following mapping $$T_d:\mathbb{Z}\to\mathbb{Z}$$ was defined in a paper Wondrous Numbers - Conjecture about the 3x + 1 family, Blanton C. Wiggin, J. Recreational Math. 20, No. 2 (1988), 52-56.

Let $$d\geq 2$$. Then $T_d(x)=\left\{\begin{array}{ll} \frac{x}{d} &\mbox{if $$x\equiv 0 \pmod{d}$$,}\\ \frac{(d+1)x-j}{d} &\mbox{if $$x\equiv j \pmod{d}, 1\leq j\leq d-2$$,}\\ \frac{(d+1)x+1}{d} &\mbox{if $$x\equiv -1 \pmod{d}$$.} \end{array} \right.$ For example, $$d=2$$ gives the $$3x+1$$ mapping: $T_2(x)=\left\{\begin{array}{ll} \frac{x}{2} &\mbox{if $$x\equiv 0 \pmod{2}$$,}\\ \frac{3x+1}{2} &\mbox{if $$x\equiv 1 \pmod{2}$$.} \end{array} \right.$ $$T_d$$ is an example of a relatively prime mapping, in the language of Matthews and Watts, where $$m_0=1, m_j=d+1, 1\leq j\leq d-1$$ and where we have the inequality $\prod_{i=0}^{d-1}\frac{m_i}{d}=\frac{1}{d}\left(1+\frac{1}{d}\right)^{d-1}<1.$ So it seems certain that the sequence of iterates $$n, T_d(n), T_d^2(n),\ldots$$ always eventually enters a cycle, and that there are only finitely many such cycles.

We have $$T_d(j)=j$$ for $$-1\leq j\leq d-2, d>2$$ and Wiggin conjectured that every trajectory starting at a positive integer will eventually reach some $$j$$ in the range $$1\leq j\leq d-2$$.

The conjectural picture for negative input is less clear. For example, with $$d=3, 6, 8, 9, 10$$ it seems that all negative trajectories will end up at $$-1$$. However, for $$d=4$$, negative trajectories may end up in the cycle $$-9, -11, -14, -18, -23, -29, -36$$ as well as $$-1$$.

Here is a table of d for which there are exceptional cycles.

Enter d (2 ≤ d ≤ 100):
Enter x (x ≥ 1) :