title: Pyramid scheme formula in PHP?
body: <p>I'm working on a referral system - the formula is exactly like the pyramid/ponzi scheme.</p>
  
  <p>The system works like this:</p>
  
  <p>The initial user signs up (tier 1)<br>
  The initial user refers 3 friends (tier 2)<br>
  Each of those 3 friends refer another 3, (tier3)<br>
  etc.</p>
  
  <p>What would be the mathematical formula for that?<br>
  How could I code up something in PHP where I could enter a number and it will then give me the number of tiers it has gone down and a semi-visual.</p>
  
  <p>ie: I enter 13 - it displays the text <code>"3 tiers"</code> and then displays  </p>
  
  <pre><code>     o
       |
      ooo
     / | \
   ooooooooo
  </code></pre>