Step 1: A source of conjecture
If you took the hint in the previous step and looked up the word “collatz”, you will probably have found that it’s the name of a mathematician, Lothar Collatz, and that he gave his name to a famous unsolved problem in mathematics.
We’re not going to By all means have a go if you fancy it! the conjecture in this tutorial; rather, we’re going to play around with it a bit to learn some Ursa.
We’ll eventually try to explain every corner of the program we saw in the last step. It will take a while, since we’re starting from scratch! Don’t worry if not everything is clear at first; we’ll try to get a sense of what the code is doing gradually.
This is what a programmer typically does when they read new code for the first time. Often, they won’t ever need to understand every nuance of a particular piece of code; just like when reading a book, they might be skimming it to see if it’s relevant, or to see roughly what it does.
So let’s see what we can see, starting “at the top” and working down…