I'm trying to solve the Collatz conjecture, and am having some trouble designing a function that divides a number by two until it's odd.
Here is what I've thought of.
We know $a\mod b = \arctan(\tan(\frac{a\pi}{b}-\frac{\pi}2))\frac{b}\pi + \frac{b}2 $
Thus,
$$f(x) = \frac{x}2 + \frac{x}2(x \mod 2) = \frac{x}2 + \frac{x}2(arctan(\tan(\frac{x\pi}{2}-\frac{\pi}2))\frac{2}\pi + \frac{2}2) = \frac{x}2 + \frac{x}2(arctan(\tan(\frac{x\pi}{2}-\frac{\pi}2))\frac{2}\pi +1)$$
What would this do? This function would return half the number, if $ x \mod 2 = 0$, else, return the whole number, because it's already odd.
The thing is, if I want to make sure any number is odd, I'd have to iterate this infinite times. I know some functions are easily iterated, but can all functions be iterated in theory? I know it may be hard, but the whole conjecture is tough by itself, so I don't really care.
One extra question, notice
$$a\mod b = \arctan(\tan(\frac{a\pi}{b}-\frac{\pi}2))\frac{b}\pi + \frac{b}2 = (\frac{a\pi}{b}-\frac{\pi}2)\frac{b}\pi + \frac{b}2$$
Is this simplification correct?
EDIT: The simplification collapses to $ a \neq a \mod b$, so that's out of the question.
If you insist on using trig functions you can do the following. Consider the sequence of functions $$ \begin{aligned} f_0(x)&=1,\\ f_1(x)&=\frac12(1+\cos\pi x),\\ f_2(x)&=\frac14(1+\cos\frac{\pi x}2+\cos\pi x+\cos\frac{3\pi x}2),\\ \vdots&\qquad\\ f_k(x)&=\frac1{2^k}\sum_{j=0}^{2^k-1}\cos\frac{j\pi x}{2^{k-1}},\\ \vdots&\qquad \end{aligned} $$ At integer points they have the properties:
Therefore the series $$ F(n):=f_0(n)-\frac12f_1(n)-\frac14f_2(n)-\cdots=1-\sum_{k=1}^\infty 2^{-k}f_k(n) $$ has the value $F(n)=2^{-\nu_2(n)}$ at any integer $n$.
Consequently $$ x F(x) $$ divides an integer $x$ by all the powers of two that still produce an integer.
Unless I made a mistake the series $F(x)$ converges uniformly everywhere, so it is a continuous function. Here's a plot of the sum of the first five terms, call it $S_4(x)$, in the interval $x\in[0,16]$.
Here's the corresponding plot of $x S_4(x)$.
I doubt you can approach Collatz in this way, but who am I to forbid anyone to think outside the box :)