Tuesday, March 15, 2016

recurrence relations - Whats better: 1 million dollars in a month or a penny(USD) doubled (and added) every day for 30 days?


THis is a question that I remember when I was in the 5th grade that tested our logical reasoning skills. And it is a simple choice knowing that the pennies doubling every day is an exponential function, but I'm trying to figure out how to create a formula for this solution without adding everything up by hand.


I know this has to be some form of a recurrence relation, but I cant figure out how to solve it. so far I have written down


$F(n) = 2F(n-1)$ which wolframalpha solves for me as $c_1 2^{n-1}$ (I don't know what the $c_1$ is, so I assume its a constant).


and then when I plug in


$\sum_{n = 1}^{30} 2^{n-1}$ it spits out $\$1,073,741,823$


Which is wrong because when I sum up all the days I get $10,737,418.23


I think the main problem is the recurrence relation I set up, but its been so long since my discrete math class, I've forgotten completely how to set that up.


Answer




Wolfram alpha is right, 1 penny is $0.01\$ $ so $c_1=0.01$. As it is a geometric series you could caluclate $c_1 2^{30}-1 $ directly.


$c_1$ is the value you get at the first day.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...