Exercise 3: Collatz Conjecture Using Recursion
Calculate the sum of the digits of a number by using recursion.
We'll cover the following...
We'll cover the following...
Problem statement
Implement the recursive function to calculate the sequence of the Collatz Conjecture for a given number.
The Collatz Conjecture states that for any positive integer:
If the number is even, divide it by 2.
If the number is odd, multiply it by 3 and add 1.
Repeat the process for the resulting number until you reach 1.
Write a recursive function collatzSteps that calculates the sequence of numbers in the Collatz Conjecture and returns the steps required to reach 1.