title: Counting the minimum number of operations needed to reach a certain number
body: <p>How should I implement an algorithm for this challenge?</p>
  
  <p>Have three integers, A, B and C.</p>
  
  <p>Your calculator starts off with the number 1, and it must reach C. To do this, you can perform two operations:</p>
  
  <ul>
  <li>Multiply your number by A (if the result has more than 4 digits, the result will be 1).</li>
  <li>Divide your number by B (integer division).</li>
  </ul>
  
  <p>You must return the minimum number of operations needed to reach C.</p>
  
  <p>Also, your calculator only has four digits, so you can expect A, B and C input to be, at most, 9999.</p>
  
  <p>Example:</p>
  
  <pre><code>A = 2, B = 3, C = 10
  
  1*A = 2 
  2*A = 4 
  4*A = 8 
  8*A = 16 
  16/B = 5 
  5*A = 10
  </code></pre>
  
  <p>So the result would be <code>6</code> steps.</p>
  
  <hr>
  
  <p>I once did it by brute-forcing the result (try lots of combinations and grab the one with the least number of steps). That was silly.</p>