Shortcut Collatz function

ID: shortcut-collatz-function

The Collatz function is not very elegant in that the odd case is always even because is odd, so it is always predictably followed by a division by two. This is not the case for the even case, where the result can be either even or odd.
A much more elegant formulation is to immediately also divide by two when the number is odd:

New to topics? Read the docs here!