Collatz code
Almost 2 years ago - I remembered about a puzzle my maths teacher gave us. It went something like this: "Start with any positive number. If it's an even number, divide that number by two. If it's odd, multiply your number by three and add one. Then repeat with the number you have. "Continue," he said. "And you will likely always return to one." I started with 72. Dividing that by 2, I got 36, then 18, then 9. I multiplied 9 by 3 to get 27, and added 1. 28 is even, so that becomes 14, then 7. 7 multiplied by 3 and add 1, is 22, which can be divided to 11. Then there was 34, 17, 52, 26, 13 before things seem to get there. 13 transforms to 40, which can be divided by 2 to give 20. Then 10. Then 5. At this point, I wondered where we were going next. Well, the next number was 16, a power of two. Then 8, 4, 2, 1. Ta dah! After I'd remembered this fun, number game I wanted to learn more about it. A quick Google search yielded that it was called the Co...