I'd like to find the minimum integer value of $t$ for which the following inequations 1 and 2 are true (one value of $t$ by inequation).
These equations represent someone contributing monthly an amount $M$ to an investment portfolio and the investor is wondering when he will achieve a certain amount $C$ given the compounded interest rate. In the equation 2, the person adapts its contribution to the inflation rate (he contributes more as the inflation rise).
$t$ is a positive integer. $M$ and $C$ are positive real numbers. $\mathit{interest\_rate}$ and $\mathit{inflation\_rate}$ are real numbers strictly greater than 1.
\begin{equation} C < \sum_{i=0}^{t} M \cdot interest\_rate^i \end{equation} \begin{equation} C < \sum_{i=0}^{t} M \cdot inflation\_rate^i \cdot interest\_rate^i \end{equation}
I can solve this problem using code (example for second equation, Python 3.8):
interest_rate = 1.08 ** (1 / 12)
inflation_rate = 1.02 ** (1 / 12)
portfolio = 0
M = 1000
C = 1_750_000
t = 0
while C > portfolio:
t += 1
portfolio += M * inflation_rate ** t * interest_rate ** t
print(f"{t // 12} years and {t % 12} months")
But I'm a complete loss to find a closed form.
Let $x=t$, $r$ be the interest rate (or the product of interest rate and inflation rate), and thus you want to know when:
$$\sum_{i=0}^x{r^i} = \frac{r^{x+1}-1}{r-1}\gt \frac{C}{M}$$
i.e.
$$r^{x+1}>\frac{C}{M}(r-1)+1$$
$$(x+1)\log{r}>\log{\left(\frac{C}{M}(r-1)+1\right)}$$
$$x>\frac{\log{\left(\frac{C}{M}(r-1)+1\right)}}{\log{r}}-1$$
So the result is:
$$\Big\lceil{\frac{\log{\left(\frac{C}{M}(r-1)+1\right)}}{\log{r}}-1}\Big\rceil$$
Note that when $r \approx 1$, $\log{\left(\frac{C}{M}(r-1)+1\right)} \approx \frac{C}{M}(r-1)$ and $\log{r} = \log{(r-1+1)} \approx (r-1)$, and so the value is about $\frac{C}{M}-1$ as one would expect.