The problem is
Given a positive integer $n$, what is the minimum number of operations to make the number 1. There are 3 options to choose from (1) if the number is even you can divide by 2. (2) for any number you can add 1. (3) for any number you can subtract 1
So for example, the minimum number of operations to make $15$ become $1$ is the following path:
$$ 15 \rightarrow 16 \rightarrow 8 \rightarrow 4 \rightarrow 2 \rightarrow 1 $$
another example
$$ 13 \rightarrow 12 \rightarrow 6 \rightarrow 3 \rightarrow 2 \rightarrow 1 $$
It's pretty obvious to me that for any number, if it is even, we should divide by 2 immediately instead of adding or subtracting 1.
What is not obvious to me is that apparently, the optimal solution is such that if you have an odd number, you should either add 1 or subtract 1, depending on which operation gets you to a number that is divisible by 4. So based on this, if we had a number like $21$, we would want to subtract 1 and get to 20 instead of adding 1 and getting to 22 because $20$ is divisible by 4.
Can someone explain to me why the optimal trajectory is to choose the increment/decrement that gets you to a multiple of 4? I also understand that for any given odd number, adding or subtracting will make the resulting number divisible by 2, but exactly 1 such choice will make the number divisible by 4.
Edit 1: Is the intuition of wanting divisibility by 4 because for any number is divisible by 4, we can divide by 2 two times, and for any number that is not divisible by 4, then we can only divide by 2 one time and the resulting number is odd.