Implement Collatz conjecture solver.