What’s wrong with my strategy for this number-theoretic game?

69 Views Asked by At

The game is defined as follows.

Starting with a positive integer $N$, you can repeatedly perform one of two operations on $N$:

  • If $N=ab$, replace $N$ by $\max(a,b)$.
  • Subtract $1$ from $N$.

Find the minimum number of operations required to reduce $N$ to $0$.

After working for few $N$'s, I got that for any composite $N$, we can reduce $N$ to zero in a minimal number of steps if we change $N=\max(a,b) $ , where $ (a,b) $ is the pair in which $N=ab$, and $b$ is as small as possible, and $a \leq b$. For any prime $N$, we can only subtract 1, and continue with $N-1$.

For instance, if $N=48$, the pair described above is $(6, 8)$, leading to the solution

$$ 48 \to 8 \to 4 \to 2 \to 1 \to 0 $$

which is 5 moves long.

My strategy seems to be invalid. Why is that?