Completed Collatz Function