
We take any whole number N, greater than 0. If N is even, we halve it (N/2), else we do "triple plus one" and get 3N+1. Repeat. The conjecture is that for all numbers this process converges to 1.
http://en.wikipedia.org/wiki/Collatz_conjecture
I don't like mathematical equations formulated with "if ... else ..." constructs. They're not amenable to algebraic manipulation. Let's reformulate the Collatz function as a sum:
f(n) = ((3n + 1) * n%2) + (n/2 * (1  n%2))
How does this work? When n is even, n%2 will be zero, and the (3n + 1) half of the equation will become zero also. When n is odd, (1  n%2) will be zero, and the n/2 half of the equation will become zero.
Now we can do algebra.
( Also, we can graph the function.Collapse )