pull down to refresh

Ah yes, how about this:

optimal_move = if N ≤ 2: invalid
if N ≤ 4: N-1
if N mod 4 ∈ {1,3}: 2
if N mod 4 ∈ {0,2}: 3