Hi, all. I just found this Collatz conjecture: Choose a number. If the number is even, divide it by two and repeat the process. If the number is odd, multiply the number by three and add 1. Then divide the number by two.
It is conjectured this leads to an infinite loop with the last three numbers in the list of outputs being 4, 2, 1.
I'm trying to make a loop that prints the outputs and stops I after the three terms 4, 2, 1 are printed in order.
I think I need to include pattern matching code to stop the loop after 4, 2, 1 are printed in order.
Thank you.
Attachments: