I'm trying to write a
Efficient Ponzi scheme calculator that when given: the initial amount invested, a maximum number of recruits that a recruiter may have, the entry fee and the percentage of the entry fee each recruiter can keep. It returns a minimum number of persons that must be recruited for the initial investment may be recouped.
n: the number of dollars invested
b: the maximum number of recruits that a recruiter may have
m: the entry fee
r: the percentage of earnings each recruiter is allowed to keep.
Here is the Code I have written:
def findNumPersons(n, b, m, r): initial_earn=b*m i=0 custom_earn=m*(r/100) ans_returns=m-custom_earn recruits=0 counter=1 while(i<n): i=initial_earn+(recruits*ans_returns) counter+=1 recruits+=1 return counter
My challenge is that as n get larger and (b,m,r) get smaller it takes longer to calculate the minimum amount of persons.