Minimum number of operations to make a positive integer 1 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.
 A: Your intuition is right (except for $n=3$). You want to be able to divide by $2$ as many times as possible.
Let $f(n)$ be the minimum number of operations to get to $1$. Given $n = 4k+1$, you have two choices: To add $1$ then divide by $2$ to make it $2k+1$ (2 steps) or to subtract $1$ then divide by $2$ twice to make it $k$ (3 steps). In a similar way, for $2k+1$, you have two options: to make it $k$ (which is clearly pointless) or $k+1$ (which both take two steps). This means that for adding $1$ to be a better choice than subtracting $1$, $f(k+1)+4 < f(k)+3$ or equivalently $f(k+1) + 1 < f(k)$ must be true. But this is impossible since $f(k)$ and $f(k+1)$ differ by at most $1$. This only shows that subtracting $1$ is as good or better than adding $1$, not necessarily better (which is not the case with $n = 29$ for example).
Similarly, if $n = 4k-1$, you can make it $k$ by adding $1$ (3 steps) or $2k-1$ by subtracting $1$ (2 steps). If $k = 1$, then $2k-1$ is already $1$, so $f(3) = 2$ is a special case. Following in a similar way to the $n = 4k+1$ case, for subtracting $1$ to be a better choice than adding $1$, $f(k-1)+1<f(k)$ must be true. But this is impossible since $f(k-1)$ and $f(k)$ differ by at most $1$. This only shows that adding $1$ is as good or better than subtracting $1$, not necessarily better (which is not the case with $n=27$ for example).
This means that $f(4k-1) = 3+f(k)$, $f(4k+1) = 3+f(k)$, and you already found that $f(2k) = 1+f(k)$.
