Optimal interest compounding frequency I am trying to figure out what is the optimal compounding frequency for annual interest $\mathbf r$ and compounding count $\mathbf n$.
I calculated that for $\mathbf n \rightarrow \infty$ the compounded interest approaches $\mathbf e^r$, but compounding infinitely many times is not very practical.
Especially when the compounding must be done manually or there might be a small fixed transaction fee charged for every compounding (in cryptocurrency yield farming for example).
To start I am trying to figure out how many times do I need to compound to reach 90% of the theoretical maximum $\mathbf e^r$ so I figured I need to solve the following equation for $\mathbf n$:
$$\left( 1+\frac{r}{n}\right)^n = 0.9e^r$$
How do I do that? Using natural log does not seem to help much. Also how would I modify the equation to account for a fixed transaction fee (every time compounding is done)?
 A: You can make a quick determination using the following inequality which holds for all $n \in \mathbb{N}$ and $r > -n$,
$$e^r \left(1 - \frac{r^2}{n}\right) \leqslant \left( 1 + \frac{r}{n}\right)^n \leqslant e^r$$
If $r = 5\%$, then $  \left( 1 + \frac{r}{n}\right)^n \geqslant e^r \left(1 - \frac{r^2}{n}\right)> 0.9 e^r$ holds for all $n >0.05^2/0.1 = 0.025$. In other words,  the discretely compounded amount exceeds $0.9e^r$ in the case where $r = 5\%$ for any frequency.
Only with very high interest rates will this condition not hold for all $n \geqslant 1$. For example, if $r = 55\%$, then
$$\left( 1 + \frac{0.55}{1}\right)^1= 1.55 < 0.9e^{0.55}\approx 1.55998 < 1.625625 = \left( 1 + \frac{0.55}{2}\right)^2$$
In this case, we have $e^r \left(1 - \frac{r^2}{n}\right)> 0.9 e^r$ for $n > 0.55^2/0.1 = 3.025$. Because the bound is not extremely tight it determines that $0.9e^r$ is first exceeded when $n \geqslant 4$ when in fact this is true for $n \geqslant 2$. Nevertheless, it provides a reasonable guide.
Proof of inequality
Since $e^x \geqslant 1 +x$ and $e^{-x} \geqslant 1 - x$ for $x \geqslant 0$ we have for $r \geqslant -n$,
$$\left(1+
   \frac{r}{n}\right)^n \leqslant e^{r}\leqslant \left(1- \frac{r}{n}\right)^{-n},$$
and
$$0 \leqslant e^{r} - \left(1+ \frac{r}{n}\right)^n = e^{r}\left[1 - e^{-r}\left(1+ \frac{r}{n}\right)^{n}\right]\\ \leqslant e^{r}\left[1 - \left(1- \frac{r}{n}\right)^{n}\left(1+ \frac{r}{n}\right)^{n}\right]\\= e^{r}\left[1 - \left(1- \frac{r^2}{n^2}\right)^{n}\right]$$
By Bernoulli's inequality, we have
$$\left(1- \frac{r^2}{n^2}\right)^{n}\geqslant 1 - n \cdot \frac{r^2}{n^2} = 1 - \frac{r^2}{n},$$
and it follows that
$$0 \leqslant e^{r} - \left(1+ \frac{r}{n}\right)^n \leqslant e^r \frac{r^2}{n}$$
A: The only explict solution of
$$\left( 1+\frac{r}{n}\right)^n = k(r)$$ is given by
$$n=-\frac{r \log (k(r))}{r W_{-1}\left(-\frac{k(r)^{-1/r} \log (k(r))}{r}\right)+\log(k(r))}$$ where $W_{-1}(.)$ is the secondary branch of Lambert function
Make $k(r)=\frac 9{10} e^r$ and obtain
$$n=-\frac{r \left(r-\log \left(\frac{10}{9}\right)\right)}{r
   W_{-1}\left(-\frac{\left(\frac{10}{9}\right)^{\frac{1}{r}} \left(r-\log
   \left(\frac{10}{9}\right)\right)}{e r}\right)+r-\log
   \left(\frac{10}{9}\right)}$$
use the series expansion given in the linked page.
