0

Guys help here I'm so lost as how to answer this question, I'm infact clueless...Find the two smallest different input numbers x,y (with 0<x<y), for which the COLLATZ algorithm takes equally many iterations until termination! and How many iterations does the COLLATZ algorithm take for each of these two different input numbers?

0

Try to implement collatz function using recursion. Work it out for a single number and check if it's printing right number of steps.

If you have implemented this, most of the important stuff is done.

The next part would be to start a loop and store each number, along with number of steps it's taking (collatz algorithm), inside any data-structure (list, dictionary etc.)

When you encounter any two numbers having same iterations, stop there! Break out of the loop and print those two numbers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .