title: efficient X within limit algorithm
body: <p>I determine limits as <code>limit(0)=0; limit(y)=2*1.08^(y-1), y∈{1,2,3,...,50}</code> or if you prefeer iterative functions:</p>
  
  <pre><code>limit(0)=0
  limit(1)=2
  limit(y)=limit(y-1)*1.08, x∈{2,3,4,...,50}
  </code></pre>
  
  <p>Exmples:</p>
  
  <pre><code> limit(1) = 2*1.08^0 = 2
   limit(2) = 2*1.08^1 = 2.16
   limit(3) = 2*1.08^2 = 2.3328
   ...
  </code></pre>
  
  <p>for a given <code>x∈[0,infinity)</code> I want an efficient formula to calculate <code>y</code> so that <code>limit(y)&gt;x and limit(y-1)≤x</code> or 50 if there is none.</p>
  
  <p>Any ideas? 
  or is pre-calculating the 50 limits and using a couple of ifs the best solution?</p>
  
  <p>I am using erlang as language, but I think it will not make much of a difference.</p>