title: How to calculate how long it will take for a number to reach the maximum using recursion?
body: <p>I'm writing a recursive function to analyze various species population growth over time. I have four parameters: The initial population of the species in the first year (a), the year where I want to see what the population will be in years to come (b), the growth rate in a percentage (c) and lastly the maximum amount of the certain species the environment can handle (d).</p>
  
  <p>(Population growth formula I am using is (a * b-1 + c) * (a *b-1) * 1 - (a * b-1/d))</p>
  
  <p>So far this is what I have:</p>
  
  <pre><code>def animal_growth(a,b,c,d):
      growth = (a * b-1 + c) * (a *b-1)
      max_growth = growth * 1 - (a * b-1/d)
      if a &gt; 10000:
           return 
      else:
           return max_growth 
  
   animal_growth(200,20,0.05,5000)
  </code></pre>
  
  <p>So in the above example, I'm looking to find how long it will take for the animal population to exceed 5000 at a growth rate of 5% per 'year', long with what that population will be in 20 years, starting with the population at 200.</p>
  
  <p>I was hoping to get a console output something like:</p>
  
  <pre><code>  8.4 # how long it will take to exceed 5000 
    6000 # the population after 20 years 
    # neither of these might be correct so if there are different answers no worries
  </code></pre>
  
  <p>I'm stuck on the recursive end of things, the formulas and math I understand. </p>
  
  <p>Thank you for your help!</p>