0

Question: What methods or formulas do you know, which can tell you how accurate $s_N=\sum\limits_{k=0}^{N}\frac{1}{k!}$ is approximating Euler's number to a given decimal place $n$?

my attempt:

Let $N \in \mathbb{N}$ then consider $N!e=\sum\limits_{k=0}^{\infty}\frac{N!}{k!}$, which can be rewritten as $$N!e=N!(\overbrace{\sum\limits_{k=0}^{N}\frac{1}{k!}}^{s_N}+\sum\limits_{k=N+1}^{\infty}\frac{1}{k!})\iff N!(e-s_N)=\sum\limits_{k=N+1}^{\infty}\frac{N!}{k!}=\sum\limits_{k=1}^{\infty}\prod\limits_{m=1}^{k}(N+m)^{-1}\\<\sum\limits_{k=1}^{\infty}\frac{1}{(N+1)^k}=\frac{\frac{1}{N+1}}{1-\frac{1}{N+1}}=\frac{1}{N}.$$

Now dividing by $N!$ we get $e-s_N<\frac{1}{NN!}$. Then by solving the equation $NN!=10^n$ and taking the ceiling of the resulting $N$, we should optain a value which at least gives us $n$ accurate digits.

I have testet this formula for small values of $n$ and it seemes to be quite precise, but i dont know wether or not this trend continuous for larger values of $n$. Besides that there is the problem of evaluating the found equation. One could further reduce the approximation by the fact that $\frac{1}{NN!}\leq\frac{1}{N!}$, but this still leaves us with the nasty factorial. Maybe you could get a shot at solving this by using the gamma function or the stirling-approximation, but that doenst seem to improve the situation much further.

Gary
  • 36,640
Emar
  • 420
  • 1
    The most straightforward method (assuming you know the following fact) is to look at the formula for the remainder at the Taylor's series: https://en.wikipedia.org/wiki/Taylor%27s_theorem#Explicit_formulas_for_the_remainder – Dmitry Dec 13 '24 at 19:09
  • Your $e-s_N<\frac{1}{N,N!}\le\frac{1}{N!}$ is correct. There is a slight issue over rounding, so it may be wise to check that adding $\frac{1}{N!}$ cannot change the final digit of your approximation, by calculating a few extra digits and using a slightly larger $N$. As for solving your equation, you might also want to note that if $n!=k$ then $\frac{\ln(k)}{\ln(\ln(k))} < n < 2\frac{\ln(k)}{\ln(\ln(k))}$ when $n \ge 4$ i.e. when $k\ge 24$, which at least puts some loose bounds on what you are looking for. – Henry Dec 13 '24 at 19:35
  • @njuffa: good point: "seel" is a word that often comes up in English word puzzles. It is not a cheery word, either in the sense of sowing closed the eyelids of a raptor for training purposes, or in the sense of closing the eyes of a corpse. (Apologies for making what must be the MSE comment with the least mathematical content of all time!) – Rob Arthan Dec 13 '24 at 21:31
  • If you want to solve for $n$ the equation $$n,n!=10^k$$ consider instead, to make life easier $$(n+1)!=10^k$$ and use https://math.stackexchange.com/questions/430167/is-there-an-inverse-to-stirlings-approximation/461207#461207 where@Gary gave an almost exact solution. – Claude Leibovici Dec 14 '24 at 08:59

1 Answers1

2

$$S_n=\sum\limits_{k=0}^{n}\frac{1}{k!}=e\,\frac{ \Gamma (n+1,1)}{\Gamma (n+1)}$$ If $n$ is large $$\Delta_n=e-S_n \sim \frac{e^n\, n^{-n-\frac{3}{2}}}{\sqrt{2 \pi }}$$ and we want that $\Delta_n\leq 10^{-k}$. Looking at the equality, taking logarithms, we need to solve for $n$ $$n-\left(n+\frac{3}{2}\right) \log (n)=\log(10^{-k}\sqrt{2 \pi })$$ what we can rewrite as $$\left(n+\frac{3}{2}\right)-\left(n+\frac{3}{2}\right) \log (n)=\frac 32+\log(10^{-k}\sqrt{2\pi })=C$$ Assuming that $$\log(n) \sim \log\left(n+\frac{3}{2}\right)$$ we have the solution in terms of Lambert function $$n \sim -\frac{C}{W\left(-\frac{C}{e}\right)}-\frac{3}{2}$$ which is an underestimate of the solution.

For example, if $k=10$, the above gives,as a real, $n=11.6022$ while the "exact" solution is $12.2142$.

This can be improved writing $$n-\left(n+\frac{3}{2}\right) \log (n)\sim (n+a)-(n+a)\log(n+a)-a$$ Computing the infinite norm between $n=10$ and $n=100$ gives an optimum value $a\sim \frac 65$ and the solution write $$n \sim -\frac{C}{W\left(-\frac{C}{e}\right)}-\frac{6}{5}\quad \text{where} \quad C=\frac 65+\log(10^{-k}\sqrt{2\pi })$$ which is an underestimate of the solution.

If $k=10$, the above gives,as a real, $n=12.0186$ while the "exact" solution is $12.2142$.

We can also consider that we want to find the zero of function $$f(n)=\log \left(10^k\,\frac{e^n n^{-n-\frac{3}{2}}}{\sqrt{2 \pi }}\right)$$ Using $n_0=k$, the first iterate of Newton method is $$\color{blue}{n_1=k-\frac{k}{2 k \log (k)+3}\,\log\Bigg(2\pi k^3 \left(\frac{k}{10\, e}\right)^{2 k}\Bigg)}$$ which, for $k=10$ gives $n=12.2944$.

The estimate is good because, if $$f^{(1)}(k)=-\frac{3}{2 k}-\log (k)$$ is large $$ f^{(2)}(k)=\frac{3-2 k}{2 k^2}\quad f^{(3)}(k)=\frac{k-3}{k^3}\quad f^{(4)}(k)=\frac{9-2 k}{k^4}$$ are smaller and smaller.

Taking into account this last point, the first iterate of Halley method gives a slightly more complex formula which for $k=10$ would give $n=12.2032$.

If we continue the expansion, using $$a=\log \left(\frac{e^k k^{-k-\frac{3}{2}} 10^k}{\sqrt{2 \pi }}\right)\quad \text{and}\quad b=2 k \log (k)+3$$ $$n=k+\frac{2 a k}{b}-\frac{2 a^2 (k (2k-3))}{b^3}+\cdots$$