Reputation: 71
I'm working on a referral system - the formula is exactly like the pyramid/ponzi scheme.
The system works like this:
The initial user signs up (tier 1)
The initial user refers 3 friends (tier 2)
Each of those 3 friends refer another 3, (tier3)
etc.
What would be the mathematical formula for that?
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.
ie: I enter 13 - it displays the text "3 tiers"
and then displays
o
|
ooo
/ | \
ooooooooo
Upvotes: 3
Views: 2889
Reputation: 1524
This is a geometric progression (GP), each tier's count is multiplied by a constant number (3) i.e. 1, 3, 9, 27 etc. You are concerned with the sum of the progression.
Read a simplified explanation about GP here. http://www.intmath.com/series-binomial-theorem/2-geometric-progressions.php
Upvotes: 2