Change collatz function to use recursion instead of iterate