A Journey Towards One

Given N. You can perform 3 types of operations:

You have to find the minimum number of operations needed to reach 1.


This is a companion discussion topic for the original entry at https://toph.co/p/a-journey-towards-one