I'll admit it, the notation of that wikibook problem confused me and looks a bit strange.
But basically, you start off with any number, the wikibook calls this number "a".
Let's say a = 6.
So, since
u(0) = 6, then u(1) = u(0)/2, in other words
u(1) = 6/2 = 3.
Then you apply this again, u(1) = 3, so
u(2) = 3*u(1) + 1 = 3*3+1 = 10.
Then you'd apply it again for
u(3)... etc etc.
So the first 3 terms in the sequence are [6, 3, 10]. Keep going this process until the next term in the sequence is 1, then you can stop. (Until it becomes one, however, you are not allowed to eat or sleep, so you better work fast!)
If you want an explanation in English, look at this excerpt from
https://en.wikipedia.org/wiki/Collatz_conjecture :
Wikipedia wrote: |
---|
Take any natural number n. If n is even, divide it by 2 to get n / 2. If n is odd, multiply it by 3 and add 1 to obtain 3n + 1. Repeat the process (which has been called "Half Or Triple Plus One", or HOTPO) indefinitely. The conjecture is that no matter what number you start with, you will always eventually reach 1. The property has also been called oneness. |
Edit: Attempted my own explanation using the Wikibook terminology (see top of post)
How did this Collatz guy even come up with this? Look at the fractal on the wiki page, amazing... it looks like a Mandelbrot fractal... BUT IT'S NOT!!11
PS: Mandatory xkcd link:
https://xkcd.com/710/