1 Introduction

The sequence of WallisFootnote 1 ratios \(w_n\), defined in the literature as

$$\begin{aligned} w_n:=\prod _{k=1}^n\frac{2k-1}{2k}\equiv \frac{(2n-1)!!}{(2n)!!}\equiv 4^{-n}\left( {\begin{array}{c}2n\\ n\end{array}}\right) , \end{aligned}$$
(1)

is often encountered in pure and applied mathematics and in some exact sciences. For example, we meet it in combinatorics, number theory, probability, statistics, statistical physics and quantum mechanics.

The Wallis ratios were investigated by many authors, see, for example, the papers [3, 4, 7,8,9,10, 12,13,14,15,16,17, 19, 20]. Naturally, during the long period a great amount of papers concerning the Wallis ratios have been published. Remarkable is Mortici who publish a lot of papers concerning the Wallis sequence or the Wallis ratio. For example, among the references in [5] there are sixteen Mortici’s papers and the reference list of [6] contains even eighteen Mortici’s articles.

In [20] was presented the double inequality

$$\begin{aligned} \frac{1}{\sqrt{e\pi n}}\left( 1+\frac{1}{2n}\right) ^{n-\frac{1}{12n}}< w_n \le \frac{1}{\sqrt{e\pi n}}\left( 1+\frac{1}{2n}\right) ^{n-\frac{1}{12n+16}}, \end{aligned}$$

valid for \(n\ge 1\).

In [7] was demonstrated the two-sided inequality

$$\begin{aligned} \sqrt{\frac{e}{\pi }}\left( 1-\frac{1}{2n}\right) ^n\frac{\sqrt{n-1}}{n}< w_n \le \frac{4}{3}\left( 1-\frac{1}{2n}\right) ^n\frac{\sqrt{n-1}}{n}, \end{aligned}$$

true for \(n\ge 2\). Recently, in [8] was derived the estimates

$$\begin{aligned}&\left( \frac{2}{3}\right) ^{3/2}\left( 1-\frac{1}{2n}\right) ^{n+1/2}\left( n-\frac{3}{2}\right) ^{-1/2}\\&\quad \le w_n < \sqrt{\frac{e}{\pi }}\left( 1-\frac{1}{2n}\right) ^{n+1/2}\left( n-\frac{3}{2}\right) ^{-1/2}, \end{aligned}$$

both valid for \(n\ge 2\). At the same time, in [17, Theorems 4.2 and 5.2] were presented the estimates

$$\begin{aligned} w_n > \sqrt{\frac{e}{\pi n}}\left( 1-\frac{1}{2n}\right) ^n\,\exp \left( \frac{1}{24n^2} +\frac{1}{48n^3}+\frac{1}{160n^4}+\frac{1}{960n^5}\right) , \end{aligned}$$

and

$$\begin{aligned}&\sqrt{\frac{e}{\pi n}}\left( 1-\frac{1}{2(n+1/3)}\right) ^{n+1/3}\\&\quad< w_n <\sqrt{\frac{e}{\pi n}}\left( 1-\frac{1}{2(n+1/3)}\right) ^{n+1/3}\, \exp \left( \frac{1}{144n^3}\right) , \end{aligned}$$

all true for \(n\ge 1\).

Additional several new results were also recently given in [5, 6]. For these two papers, the important reference is thirty years old paper [18], where the author accurately estimated the function \(x\mapsto \Gamma (x+1)/\Gamma (x+\frac{1}{2})\equiv 1/(w_n\sqrt{\pi })\) using an integral representation of it. In our contribution, we shall show that similar results can be obtained using Stirling’s approximation for factorials. Indeed, according to (1), we have

$$\begin{aligned} w_n =\frac{\prod \nolimits _{k=1}^n(2k-1)\cdot \prod \nolimits _{k=1}^n(2k)}{\Big (\prod \nolimits _{k=1}^n(2k)\Big )^2}=\frac{(2n)!}{2^{2n}(n!)^2} =\frac{\Gamma (2n+1)}{4^n\big (\Gamma (n+1)\big )^2}\,, \end{aligned}$$
(2)

that is

$$\begin{aligned} w_n = \frac{2}{n\cdot 4^n}\cdot \frac{\Gamma (2n)}{\big (\Gamma (n)\big )^2} \qquad (n\in \mathbb {N}). \end{aligned}$$
(3)

Remark 1

We should express \(w_n\) also in a different way, for example, as

$$\begin{aligned} w_n = \frac{2^n\prod \nolimits _{k=1}^n\left( k-\frac{1}{2}\right) }{2^n\cdot n!} =\frac{\Gamma \left( n+\frac{1}{2}\right) }{\Gamma \left( \frac{1}{2}\right) \Gamma (n+1)}=\frac{\Gamma \left( n+\frac{1}{2}\right) }{\sqrt{\pi }\,\Gamma (n+1)} \qquad (n\in \mathbb {N}). \end{aligned}$$

However, this form is less suitable for further work with Stirling’s approximation because it does not enable certain short simplifications which are also aesthetically pleasing.

2 Stirling’s Approximation of \(\Gamma \) Function

The continuous version of Stirling’s factorial formula of order \(r\ge 0\), for \(x\in \mathbb {R}^+\), can be given in the following way [2, sect. 9.5]

$$\begin{aligned} \Gamma (x)=\sqrt{2\pi }\cdot \left( \frac{x}{e}\right) ^x \frac{1}{\sqrt{x}}\cdot \exp \big ( s_r(x)+ d_r(x)\big ) \,, \end{aligned}$$
(4)

where

$$\begin{aligned} s_0(x)\equiv 0\quad {\textit{and}} \quad s_r(x)=\sum _{i=1}^r\frac{B_{2i}}{(2i-1)(2i)x^{2i-1}}\quad \text {for }r\ge 1, \end{aligned}$$
(5)

and, for some \(\Theta _r(x)\in (0,1)\),

$$\begin{aligned} d_r(x)=\Theta _r(x)\cdot \frac{B_{2r+2}}{\left( 2r+1\right) (2r+2)\cdot x^{2r+1}}\,. \end{aligned}$$
(6)

Here \(B_2\), \(B_4\), \(B_6,\ldots \) are the Bernoulli coefficients. For example,

$$\begin{aligned} B_2= & {} \frac{1}{6},\; B_4=B_8=-\frac{1}{30},\, B_6=\frac{1}{42},\, B_{10}=\frac{5}{66},\, B_{12}=-\frac{691}{2730}, \nonumber \\ B_{14}= & {} \frac{7}{6},\, B_{16}=-\frac{3617}{510},\, B_{18}=\frac{43867}{798},\, B_{20}=-\frac{174611}{330},\nonumber \\ B_{22}= & {} \frac{854513}{138},\, B_{24}=-\frac{236364091}{2730} \quad \text { and } \quad B_{26}=\frac{8553103}{6}\,, \end{aligned}$$
(7)

with the estimates \(\left| B_{12}\right| <\frac{1}{3}\), \(\left| B_{16}\right| <7\), \(B_{18}<55\), \(\left| B_{20}\right| <530\), \(B_{22}<6200\), \(\left| B_{24}\right| <87000\), \(B_{26}<1.43\cdot 10^6\).

3 Accurate and Aesthetically Pleasing Approximation to \(w_n\)

From (3) and (4), we calculate

$$\begin{aligned} w_n=&\frac{2}{n\cdot 4^n}\,\sqrt{2\pi }\left( \frac{2n}{e}\right) ^{2n}\frac{1}{\sqrt{2n}}\,\exp \big (s_r(2n)+d_r(2n)\big ) \nonumber \\&\qquad \cdot \left[ \frac{1}{\sqrt{2\pi }}\left( \frac{e}{n}\right) ^n\sqrt{n}\cdot \exp \big (-s_r(n)-d_r(n)\big )\right] ^2 \nonumber \\ =&\frac{1}{\sqrt{\pi \,n}}\,\exp \big (s_r(2n)-2s_r(n)\big ) \cdot \exp \big (\delta _r(n)\big ), \end{aligned}$$
(8)

where considering [1, 23.1.15, p. 805],

$$\begin{aligned} \delta _r(n)&= \frac{\Theta _r(n)\cdot B_{2r+2}}{(2r+1) (2r+2)\cdot (2n)^{2r+1}} - \frac{2\Theta '_r(n)\cdot B_{2r+2}}{(2r+1)(2r+2)\cdot n^{2r+1}} \nonumber \\&=\frac{(-1)^r \big |B_{2r+2}\big |}{(2r+1)(2r+2)}\left( \frac{\Theta _r(n)}{2^{2r+1}}-2\Theta '_r(n)\right) \frac{1}{n^{2r+1}}\,, \end{aligned}$$
(9)

for some \(\Theta _r(n),\Theta _r'(n)\in (0,1)\). Consequently, invoking [1, 23.1.15, p. 805], we have, for \(r\ge 0\),

$$\begin{aligned} -\frac{2\big |B_{2r+2}\big |}{(2r+1)(2r+2)n^{2r+1}}<(-1)^r\delta _r(n)< \frac{\big |B_{2r+2}\big |}{(2r+1)(2r+2)(2n)^{2r+1}}\,. \end{aligned}$$
(10)

We estimate roughly, for \(r\ge 0\), referring to [1, 23.1.15, p. 805], as

$$\begin{aligned} |\delta _r(n)|&<\frac{2|B_{2r+2}|}{(2r+1)(2r+2)n^{2r+1}} \end{aligned}$$
(11)
$$\begin{aligned}&\overset{\mathrm{23.1.15}}{<} \frac{4}{1-2^{1-(2r+2)}}\cdot \frac{(2r+2)!}{(2\pi )^{2r+2}}\cdot \frac{1}{(2r+1)(2r+2)n^{2r+1}}\nonumber \\&= \frac{2}{\pi (1-2^{-(2r+1)})}\cdot \frac{(2r)!}{(2\pi n)^{2r+1}}\,. \end{aligned}$$
(12)

According to [1, 6.1.38, p. 257], we have, for \(r\ge 1\),

$$\begin{aligned} (2r)! < 2\sqrt{\pi r}\left( \frac{2r}{e}\right) ^{2r}\exp \left( \frac{1}{24r}\right) . \end{aligned}$$

Consequently, using (12), we obtain

$$\begin{aligned} |\delta _r(n)|< \widetilde{\delta }_r(n):=\frac{2\exp \left( \frac{1}{24r}\right) }{\pi n(1-2^{-(2r+1)})}\cdot \sqrt{\frac{r}{\pi }}\cdot \left( \frac{r}{e\pi n}\right) ^{2r}, \end{aligned}$$
(13)

valid for \(r\ge 1\).

Using formulas (8) and (5) we find very accurate approximations of Wallis’ ratios given in the next theorem.

Theorem 1

For integers \(n,r\ge 1\), there holds the equality

$$\begin{aligned} w_n = \widetilde{w}_r(n)\cdot \,\exp \big (\delta _r(n)\big ), \end{aligned}$$
(14)

where

$$\begin{aligned} \widetilde{w}_r(n)= & {} \frac{1}{\sqrt{\pi \,n}}\exp \big (-\widetilde{s}_r(n)\big ), \end{aligned}$$
(15)
$$\begin{aligned} \widetilde{s}_r(n)= & {} \sum _{i=1}^r\frac{(1-4^{-i})B_{2i}}{i(2i-1)n^{2i-1}}, \end{aligned}$$
(16)

and \(\delta _r(n)\) is estimated in (10)–(13).

Remark 2

The error \(\delta _r(n)\) does not preserve its sign, depending on r, as is evident from Figs. 1 and  2, where are depictedFootnote 2, for \(r\in \{1,2,8,9\}\), the graphs of the sequences \(n\mapsto \delta _r(n)\equiv \ln \left( w_n\right) +\frac{1}{2}\ln (\pi n) +\widetilde{s}_r(n)\). Figures 1 and 2 support the hypotheses that \((-1)^{r+1} \delta _r(n)>0\) for all \(r,n\in \mathbb {N}\).

Fig. 1
figure 1

Graphs of the sequences \(n\mapsto \delta _r(n)\), for \(r\in \{1,5\}\)

Fig. 2
figure 2

Graphs of the sequences \(n\mapsto \delta _r(n)\), for \(r\in \{2,6\}\)

Fig. 3
figure 3

Graphs of the sequences \(n\mapsto \widetilde{\delta }_r(n)/\big |\delta _r(n)\big |\), for \(r\in \{2,9\}\)

Remark 3

The estimates (10)–(13) are quite good as it is illustrated in Fig. 3, where are plotted the graphs of the sequences \(n\mapsto \widetilde{\delta }_r(n)/\big |\delta _r(n)\big |\) with \(\delta _r(n)\equiv \ln \left( w_n\right) +\frac{1}{2}\ln (\pi n) +\widetilde{s}_r(n)\) for \(r\in \{2,9\}\).

Corollary 1

(asymptotic expansion) For \(n\in \mathbb {N}\),

$$\begin{aligned} \ln \big (w_n\big )\sim \ln \left( \frac{1}{\sqrt{\pi \,n}}\right) -\sum _{i=1}^{\infty }\frac{(1-4^{-i})B_{2i}}{i(2i-1)n^{2i-1}} \quad \text {as }n\rightarrow \infty . \end{aligned}$$

Immediately from Theorem 1 there follows, using the finite increment theorem, the next corollary.

Corollary 2

The approximation \(w_n\approx \widetilde{w}_r(n)\) has the relative error \(\rho _r(n):=\big (w_n-\widetilde{w}_r(n)\big )/w_n\) estimated, for any \(n,r\in \mathbb {N}\), as follows [see (13)]:

$$\begin{aligned} \big |\rho _r(n)\big |=\big |1-\exp \big (-\delta _r(n)\big )\big |< \exp \big (\widetilde{\delta }_r(n)\big )\cdot \widetilde{\delta }_r(n). \end{aligned}$$

Setting \(r\in \{1,2,3\}\) in Theorem 1 and considering (11), together with (7) , we get Corollary 3.

Corollary 3

For every \(n\in \mathbb {N}\), we have the following double asymptotic inequalities:

$$\begin{aligned}&\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}- \tfrac{1}{180n^3}\right)<w_n<\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}+ \tfrac{1}{180n^3}\right) , \\&\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}+\tfrac{1}{192n^3}-\tfrac{1}{630n^5}\right)<w_m<\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}+\tfrac{1}{192n^3}+\tfrac{1}{630n^5}\right) ,\\&\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}+\tfrac{1}{192n^3}-\tfrac{1}{640n^5}-\tfrac{1}{840n^7}\right) \\&\quad<w_m <\tfrac{1}{\sqrt{\pi \,n}}\exp \left( -\tfrac{1}{8n}+\tfrac{1}{192n^3}-\tfrac{1}{640n^5}+\tfrac{1}{840n^7}\right) . \end{aligned}$$

Corollary 4

For any \(n\in \mathbb {N}\), there holds the following two-sided asymptotic inequality:

$$\begin{aligned} \frac{1}{\sqrt{\pi \,n}}\left( 1-\frac{1}{8n}\right)<w_n<\frac{1}{\sqrt{\pi \,n}}\left( 1-\frac{1}{9n}\right) . \end{aligned}$$

Proof

The left inequality follows from the left estimate of the second inequalities in Corollary 3 and the well known estimate \(e^x>1+x\), true for \(x\ne 0\).

To verify the right inequality, we consider the right estimate of the first inequality in Corollary 3 and the Taylor formula of the first order estimating \(e^{-y}<1-y+\frac{1}{2}y^2\), for \(y>0\).

Because, for \(y:=\frac{1}{8n}-\frac{1}{180n^3}\) we have \(y>\frac{1}{8n}-\frac{1}{180n}\) and \(y^2<\frac{1}{64n^2}\le \frac{1}{64n}\) we obtain

$$\begin{aligned} w_n&<\frac{1}{\sqrt{\pi \,n}}\exp \left( -y\right)<\frac{1}{\sqrt{\pi \,n}}\left( 1-y+\frac{1}{2}y^2\right) \\&<\frac{1}{\sqrt{\pi \,n}}\left( 1-\frac{1}{8n}+\frac{1}{180n}+\frac{1}{128n}\right) <\frac{1}{\sqrt{\pi \,n}}\left( 1-\frac{1}{9n}\right) . \end{aligned}$$

\(\square \)

Putting \(r=4\) in Theorem 1, we obtain Corollary 5.

Corollary 5

For any \(n\in \mathbb {N}\), we have the following inequalities:

$$\begin{aligned}&a(n):=\tfrac{1}{\sqrt{\pi \,n}}\exp \left( \tfrac{1}{192m^3}-\tfrac{1}{8n}-\tfrac{1}{640n^5}+\tfrac{17}{14336n^7}-\tfrac{1}{594n^9}\right) <w_n \end{aligned}$$
(17)

and

$$\begin{aligned}&w_n<b(n):= \tfrac{1}{\sqrt{\pi \,n}}\exp \left( \tfrac{1}{192m^3}-\tfrac{1}{8n}-\tfrac{1}{640n^5}+\tfrac{17}{14336n^7}+\tfrac{1}{594n^9}\right) . \end{aligned}$$
(18)

Using \(r=5\) in Theorem 1, we get Corollary 6.

Corollary 6

For every \(n\in \mathbb {N}\), we estimate \(w_n\) in the following way:

$$\begin{aligned}&\frac{1}{\sqrt{\pi \,n}}\exp \left( -\frac{1}{8n}+\frac{1}{192n^3}-\frac{1}{640n^5}+\frac{17}{14336n^7} -\frac{31}{18432n^9}-\frac{1}{260\,n^{11}}\right) <w_n \end{aligned}$$

and

$$\begin{aligned}&w_n< \frac{1}{\sqrt{\pi \,n}}\exp \left( -\frac{1}{8n}+\frac{1}{192n^3}-\frac{1}{640n^5}+\frac{17}{14336n^7} -\frac{31}{18432n^9}+\frac{1}{260\,n^{11}}\right) . \end{aligned}$$

4 Estimating \(\pi \) Using the Wallis Ratio

From Theorem 1, referring to (11)–(13), we yield the next theorem.

Theorem 2

For any \(n,r\in \mathbb {N}\) we have

$$\begin{aligned} \pi = \widetilde{\pi }_r(n)\cdot \,\exp \big (2\delta _r(n)\big ), \end{aligned}$$
(19)

where [see (16)]

$$\begin{aligned} \widetilde{\pi }_r(n):= \frac{1}{n\cdot w_n^2}\cdot \exp \big (-2\widetilde{s}_r(n)\big ), \end{aligned}$$
(20)

and

$$\begin{aligned} \big |2\delta _r(n)\big |<\frac{4|B_{2r+2}|}{(2r+1)(2r+2)n^{2r+1}}<\frac{4\exp \left( \frac{1}{24r}\right) }{\pi n(1-2^{-(2r+1)})}\cdot \sqrt{\frac{r}{\pi }}\cdot \left( \frac{r}{e\pi n}\right) ^{2r}. \end{aligned}$$
(21)

Directly from Theorem 2, we extract the next corollary.

Corollary 7

The approximation \(\pi \approx \widetilde{\pi }_r(n)\) has the relative error \(\varepsilon _r(n):=\big (\pi -\widetilde{\pi }_r(n)\big )/\pi \) estimated, for any \(n\in \mathbb {N}\), as follows (see (13)):

$$\begin{aligned} \big |\varepsilon _r(n)\big |=\big |1-\exp \big (-2\delta _r(n)\big )\big | <2\exp \big (2\widetilde{\delta }_r(n)\big )\cdot \widetilde{\delta }_r(n). \end{aligned}$$

Immediately from Corollary 6 we read the next corollary.

Corollary 8

For every \(n\in \mathbb {N}\), there hold the following inequalities:

$$\begin{aligned} \pi&>\frac{1}{n\cdot w_n^2}\exp \left( -\frac{1}{4n}+\frac{1}{96n^3}-\frac{1}{320n^5}+\frac{17}{7168n^7} -\frac{31}{9216n^9}-\frac{1}{130n^{11}}\right) \\&=:L_1(n) \end{aligned}$$

and

$$\begin{aligned} \pi&< \frac{1}{n\cdot w_n^2}\exp \left( -\frac{1}{4n}+\frac{1}{96n^3}-\frac{1}{320n^5}+\frac{17}{7168n^7} -\frac{31}{9216n^9}+\frac{1}{130n^{11}}\right) \\&=:L_2(n). \end{aligned}$$

Putting \(n=100\) in the inequalities of Corollary 8 and using Mathematica [21], we get the estimate

$$\begin{aligned} 3.141\,592\,653\,589\,793\,238\,462\,638\ldots<\pi < 3.141\,592\,653\,589\,793\,238\,462\,643\ldots . \end{aligned}$$

Hence, using the Wallis ratio, we yield \(\pi =3.141\,592\,653\,589\,793\,238\,462\,6\ldots \)   .

Remark 4

Mortici [11, Th. 2, p. 2617] obtained the two-sided inequality

$$\begin{aligned} M_1(n)<\pi <M_2(n), \end{aligned}$$

where

$$\begin{aligned} M_1(n)&:=\left( \frac{n+1/4}{n^2+n/2+3/32} +\frac{9}{2048n^5}-\frac{45}{8192n^6}\right) \left( \frac{(2n)!!}{(2n-1)!!}\right) ^2 \end{aligned}$$

and

$$\begin{aligned} M_2(n)&:=\left( \frac{n+1/4}{n^2+n/2+3/32} +\frac{9}{2048n^5}\right) \left( \frac{(2n)!!}{(2n-1)!!}\right) ^2. \end{aligned}$$

We estimate \(L_1(1)<M_1(1)\) and \(L_2(1)>M_2(1)\); however, \(L_1(n)>M_1(n)\) and \(L_2(n)<M_2(n)\) for \(n\in \{2,3,4,\ldots ,100\}\) since for the quotients \(q_1(n):=L_1(n)/M_1(n)\) and \(q_2(n):=L_2(n)/M_2(n)\), using Mathematica [21], we get \(q_1(n)>1\) and \(q_2(n)<1\), for \(n\in \{2,3,4,\ldots ,100\}\).