Is it possible to describe the Collatz function in one formula?

This is related to Collatz sequence, which is that $$C(n) = \begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2}\\ 3n+1 & \text{if } n\equiv 1 \pmod{2} .\end{cases}$$

Is it possible to describe the Collatz function in one formula? (without modular conditions)


Solution 1:

$$f(n)=\frac74n+\frac12+(-1)^{n+1} \left(\frac54n+\frac12\right)$$

Solution 2:

$$C(n)=\frac{n}{2}\cos^2\left(\frac{\pi n}{2}\right)+(3n+1) \sin^2\left(\frac{\pi n}{2}\right)$$

Continuous extension . M. Chamberland $(1996)$ observed that the entire function defined by $$f(x)=x+\frac{1}{4}-\frac{2x+1}{4} \cos (\pi x)$$ interpolates the $3n+1$ function: $$T(n)=\begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2}\\ (3n+1)/2 & \text{if } n\equiv 1 \pmod{2} \end{cases}$$ and $T(n)=f(n)$ for $n\in \mathbb{N}$. This allows him to try to apply methods of one-dimensional discrete dynamical systems to $3n+1$ iterations.

Chamberland, M., A Continuous Extension of the 3x + 1 Problem to the Real Line, Dynamics of Continuous, Discrete and Impulsive Systems 2 A996), 495-509.

Solution 3:

If you are searching for any way to write this in terms of elementary functions:

$$C(n)=n \cdot \left(\frac{1}{2}+\left\lfloor \frac{n}{2} \right\rfloor-\frac{n}{2}\right)+2(3n+1) \cdot \left(\frac{n}{2}-\left\lfloor \frac{n}{2} \right\rfloor\right)$$ where $\lfloor x \rfloor$ is the floor function (that is, the largest integer less than or equal to $x$).

But probably this is not the thing you were searching for...

Nonetheless, I'm quite sure that all possible such formulas involve a hidden "modulo condition" so it is probably the best way to write this in a more direct way as it's done usually...

Solution 4:

Yes. In fact, in some ways, it's easier to just use a function that gives the odd numbers in the Collatz sequence. See my question for more.

$$(1) \quad o_{n+1}={{3 \cdot o_n+1} \over {2^{v_2(3 \cdot o_n+1)}}}$$

Where $v_2(3 \cdot o_n+1)$ is the 2-adic valuation. $o_n$ is the nth odd number in the Collatz sequence.

You also have the Collatz Fractal iteration, given by,

$$(2) \quad z_{n+1}={1 \over 4} \cdot (2+7 \cdot z_n-(2+5 \cdot z_n) \cdot \cos(\pi \cdot z_n))$$

which extends the collatz function to the complex plane. I think the point to remember is that the way the Collatz function is written definitely influences how it's studied. This allows for new insights about what common threads run parallel to all the methods. We think that thread is convergence to one, but who really knows yet?

Solution 5:

You can always do this $$ C(n) = (n \bmod 2)(3n+1) + (1-(n \bmod 2))(n/2) $$