Minimum steps to 1

Why we only checking for n%2 , n%3 and n-1 only why not for every prime number occurred before n

This is because initially you are given that you can reduce any no to 1 simply by dividing by 2, dividing by 3 or reducing by 1 , and you have to select minimum of all these 3 values…