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)
 A: $$f(n)=\frac74n+\frac12+(-1)^{n+1} \left(\frac54n+\frac12\right)$$
A: You can use floor/ceiling maps. If you let $f(n) = 2*(n/2 - floor (n/2 ))$ then this function is the indicator of whether $n$ is odd or even, (i.e. $f(n) = 1$ if $n$ is odd and $f(n) = 0$ if $n$ is even), and so then you can define $C(n) = f(n)*(3n + 1) + (1 - f(n))*(n/2)$.
However, note that looking at the floor of $n/2$ and using this in your formula by comparing to $n/2$ is basically the same as having different "cases" for the value of the function depending on whether $n$ is odd or even. I don't think there's any better way around it though, if you want one formula.
A: $$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.
A: Let f be the iteration function for every even number and g for every uneven number.
\begin{align}
f(n) = \frac{n}{2}
\end{align}
\begin{align}
g(n) = 3n + 1
\end{align}
It is possible to use the right equation for the right number by using a sine function with a period of 2. This way, even numbers get iterated by f and uneven numbers by g. Let c be the sine function.
\begin{align}
c(n) = a\cdot cos(\frac{2\pi}{d}\cdot n) + b
\end{align}
, where
\begin{align}
d = 2
\end{align}
and a is the difference between both functions divided by 2.
\begin{align}
a = \frac{f(n)-g(n)}{2}
\end{align}
'b' is the average of both functions.
\begin{align}
b = \frac{f(n)+g(n)}{2}
\end{align}
Now, time to rewrite c.
\begin{align}
c(n) = \frac{f(n)-g(n)}{2}\cdot cos(\pi n) + \frac{f(n)+g(n)}{2}
\end{align}
A: 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...
A: 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?
A: You can always do this
$$
C(n) = (n \bmod 2)(3n+1) + (1-(n \bmod 2))(n/2)
$$
A: There are good answers here already but this is also a good way of looking at the Collatz problem in a single formula.
Let $\Bbb N/\langle2\rangle$ be the equivalence classes of positive integers having the same odd factors, i.e. it has the equivalence class $3\cdot\langle2\rangle=\{3,6,12,24,\ldots\}$ as an element.
Then you have $f:\Bbb N/\langle2\rangle\to\Bbb N/\langle2\rangle$
$f(x)=3x+2^{\nu_2(x)}$
where $2^{\nu_2(x)}$ is the highest power of $2$ that divides $x$.
Then the Collatz conjecture states that $f$ acts transitively, or equivalently that its orbit converges to $\langle2\rangle$ for all inputs.
