0

Given the Euler constant, computed by this formula $$\sum_{n=0}^{\infty}\frac{2n+1}{(2n)!} $$ n is positive integer, it represents sum of fractions starting from $0$ to infinity.We are given a number $p$ and we are asked to find the minimal k , for which the sum of all fractions from $0$ to $k$ has exactly $p$ digits and the $p$-th digit will never change no matter how much more we add.

For example Let us say we are given p = 4.Then our number from the first 4 digits is $2.718$ (The first 100 digits can be found here - https://miniwebtool.com/first-n-digits-of-e/?number=100 ) and I want to find out for which minimal $k$ when summing in the formula above we will get us to number with 4 digits and if we add the other terms to infinity the first 4 digits will never change.The answer is $k$ =3 because it is the sum $ 1.0 + 1.50 + 0.20833333 + 0.00972222 $ this is the sum for $n = [0;3];$ and the next fractions when added don't change the 4-th digit so the answer is k = 3.

Is the a formula to calculate this? Or some kind of approximation or upper bound for k when this will happen?

Joel
  • 21

1 Answers1

0

Suppose that we define $$a_n=\frac{2n+1}{(2n)!}\implies \frac{a_{n+1}}{a_n}=\frac{2 n+3}{2 (n+1) (2 n+1)^2}$$ Writing $$\sum_{n=0}^{\infty} a_n=\sum_{n=0}^{p}a_n+\sum_{n=p+1}^{\infty}a_n=\sum_{n=0}^{p}a_n+R_p$$ and suppose that we can approximate $$R_p \sim a_p\sum_{n=p+1}^{\infty}\frac{2 n+3}{2 (n+1) (2 n+1)^2}$$ So, $$R_p=\frac{2p+1}{2(2p)!} \left(\psi ^{(0)}\left(p+\frac{3}{2}\right)-\psi ^{(0)}(p+2)+\psi^{(1)}\left(p+\frac{3}{2}\right)\right)$$ Taking logarithms and using very early truncated expressions, $$\ln(R_p) \sim -\ln \left({4 \sqrt{\pi }}\right)-2 p (\ln (p)-1+\ln (2))$$ and we want $R_p < 10^{-k}$. This would give,as an approximation, $$p=\frac{A}{2 W\left(\frac{A}{e}\right)}\qquad \text{where} \qquad A=\ln \left(\frac{10^k}{4 \sqrt{\pi }}\right)$$ $W(.)$ being Lambert function. For sure, you will need to use $\lceil p \rceil$.

For example, for $k=10$, this would give $p=6.64$ then $p=7$. Computing rigorously $R_{10}=8.2 \times 10^{-12}$ while the approximation used here would give $1.5\times 10^{-11}$. Notice that for this working case, the exact solution is $p=6.45$.

Edit

If you need a more than reasonable shortcut evaluation of $p$, a quick and dirty nonlinear regression based on the empirical model $$p=a+ b \,k^c + d\, k^{2c}$$ leads (with $R^2>0.9999$) to $$\begin{array}{clclclclc} \text{} & \text{Estimate} & \text{Standard Error} & \text{Confidence Interval} \\ a & 0.576380 & 0.0342091 & \{0.508466,0.644294\} \\ b & 0.992048 & 0.0091845 & \{0.973815,1.010280\} \\ c & 0.762679 & 0.0021267 & \{0.758456,0.766901\} \\ d & 0.000985 & 0.0000664 & \{0.00085,0.0011173\} \\ \end{array}$$ which was built for the range $1 \leq k \leq 350$. The maximum asolute error is $|\Delta p| \leq 0.10$