Here is my problem, I want to compute the $$\sum_{i=0}^n P^i : P\in ℤ_{>1}$$ I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?
Thanks.
Here is my problem, I want to compute the $$\sum_{i=0}^n P^i : P\in ℤ_{>1}$$ I know I can implement it using an easy recursive function, but since I want to use the formula in a spreadsheet, is there a better approach to this?
Thanks.
On
The elements of your sum follow a geometric rule. It happens that the sum of a geometric series has a simple formula (if $P$ is not $1$) :
$$\sum_{i=0}^n P^i = \dfrac{P^{n+1} -1}{P-1}$$
EDIT : Let's prove this !
$(P-1)(P^n +P^{n-1}+...+1)= (P^{n+1} -P^n) +(P^n -P^{n-1})+(P^{n-1}-P^{n-2}) +...+(P-1) = P^{n+1} -1$
You have the result by dividing both sides by $P-1$.
If we call the sum $S_n$, then $$P \cdot S_n = P + P^2 + P^3 + \cdots + P^{n+1} = S_{n} + (P^{n+1} - 1).$$
Solving for $S_n$ we find: $$(P - 1) S_n = P^{n+1} - 1$$ and $$S_n = \frac{P^{n+1}-1}{P-1}$$
This is a partial sum of a geometric series.