title: Math Algorithms
body: <p>I'm trying to understand the concept of Algorithms and basically how they improve performance of a computer program.</p>
  
  <p>So assume, I have to write a program which generates a list of numbers by,</p>
  
  <ol>
  <li><p>Starts with the number 1.</p></li>
  <li><p>Adds 3 to it.</p></li>
  <li><p>Stores the result (1+3=4) in the list.</p></li>
  <li><p>Adds 5 to the new number.</p></li>
  <li><p>Stores the result (4+5=9) in the list.</p></li>
  <li><p>Keeps alternatively adding 3 and 5 to the latest number in the list.</p></li>
  </ol>
  
  <p>Now this is a very simple program and lets say it the program has to stop when the number is greater than 10,00,000, and lets suppose a simple program to do this takes 10 seconds to generate the list.</p>
  
  <p>How does one design an algorithm for this problem such that the program takes lesser time to generate the list.</p>
  
  <p><strong>NOTE</strong>- I am trying to understand the concept here with an example, the above times mentioned are random and not factual. It would be great if someone could help me understand the concept with a 'simple' example, if they do not wish to use the above example.</p>