Next Article in Journal
A Novel MADM Framework under q-Rung Orthopair Fuzzy Bipolar Soft Sets
Previous Article in Journal
Joint Universality of the Zeta-Functions of Cusp Forms
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Algorithmic Determination of a Large Integer in the Two-Term Machin-like Formula for π

by
Sanjar M. Abrarov
1,2,3,
Rajinder K. Jagpal
3,4,
Rehan Siddiqui
2,3,4,* and
Brendan M. Quine
1,2,4
1
Thoth Technology Inc., Algonquin Radio Observatory, Achray Road, RR6, Pembroke, ON K8A 6W7, Canada
2
Department Earth and Space Science and Engineering, York University, 4700 Keele St., Toronto, ON M3J 1P3, Canada
3
Epic College of Technology, 5670 McAdam Rd., Mississauga, ON L4Z 1T2, Canada
4
Department Physics and Astronomy, York University, 4700 Keele St., Toronto, ON M3J 1P3, Canada
*
Author to whom correspondence should be addressed.
Mathematics 2021, 9(17), 2162; https://doi.org/10.3390/math9172162
Submission received: 19 July 2021 / Revised: 28 August 2021 / Accepted: 31 August 2021 / Published: 4 September 2021
(This article belongs to the Section Computational and Applied Mathematics)

Abstract

:
In our earlier publication we have shown how to compute by iteration a rational number u 2 , k in the two-term Machin-like formula for π of the kind π 4 = 2 k 1 arctan 1 u 1 , k + arctan 1 u 2 , k , k Z , k 1 , where u 1 , k can be chosen as an integer u 1 , k = a k / 2 a k 1 with nested radicals defined as a k = 2 + a k 1 and a 0 = 0 . In this work, we report an alternative method for determination of the integer u 1 , k . This approach is based on a simple iteration and does not require any irrational (surd) numbers from the set a k in computation of the integer u 1 , k . Mathematica programs validating these results are presented.

1. Introduction

Historically, a computation of decimal digits of π was a big challenge until 1706, when the English astronomer and mathematician John Machin discovered a two-term formula for π as given by
π 4 = 4 arctan 1 5 arctan 1 239 ,
that is named in his honor now. Using this remarkable formula he first was able to calculate 100 decimal digits of π [1,2,3]. Nowadays the identities of kind
π 4 = j = 1 J A j arctan 1 B j ,
where A j and B j are rational numbers, are regarded as the Machin-like formulas for π . Interestingly that some of them, including the original Equation (1), can be proved geometrically [4,5]. It is very often when in the Machin-like formulas for π the constants A j and B j are both integers [6,7,8]. The more complete lists of formulas of kind (2) can be found in the references [9,10] and weblinks provided therein.
The significance of the Machin-like formulas cannot be overestimated as their application may be one of the most efficient ways in computing π . Historically, only these formulas were able to compete with Chudnovsky formula [2,11] to beat the records in computation of the decimal digits of π . In particular, in 2002, Kanada first computed more than one trillion digits of π by using the following self-checking pair of the Machin-like formulas [12]
π 4 = 44 arctan 1 57 + 7 arctan 1 239 12 arctan 1 682 + 24 arctan 1 12 , 943
and
π 4 = 12 arctan 1 49 + 32 arctan 1 57 5 arctan 1 239 + 12 arctan 1 110 , 443 .
Such an achievement made by Kanada shows a colossal potential of the Machin-like formulas for computation of the decimal digits of π .
As a simplest case one can apply the Maclaurin expansion series for computation of the arctangent functions in Equation (2)
arctan x = x x 3 3 + x 5 5 x 7 7 + = n = 0 1 n x 2 n + 1 2 n + 1
and since this equation implies
arctan x = x + O x 3 ,
we can conclude that it would be very desirable to have the coefficient B j as large as possible by absolute value in order to improve the convergence rate.
Although the Maclaurin expansion series of the arctangent function can be simply implemented, its application is not optimal. The more efficient way to compute the arctangent functions in Equation (2) is to use the Euler’s expansion formula [13]
arctan x = n = 0 2 2 n n ! 2 2 n + 1 ! x 2 n + 1 1 + x 2 n + 1 .
Alternatively, the following expansion series
arctan x = 2 n = 1 1 2 n 1 g n x g n 2 x + h n 2 x ,
where
g 1 x = 2 / x , h 1 x = 1 ,
g n x = 1 4 / x 2 g n 1 + 4 h n 1 x / x ,
h n x = 1 4 / x 2 h n 1 4 g n 1 x / x ,
can also be used for more rapid convergence. This formula can be obtained by a trivial rearrangement of the Equation (5) from our work [14] (see also [15]).
In 1938 Lehmer introduced a measure defined as [6,16]
μ = j = 1 J 1 log 10 B j .
This measure can be used to determine a computational efficiency of a given Machin-like formula for π . Specifically, when value of the constant μ is smaller, then less computational labour is required to compute π by a given Machin-like formula. Therefore, it is very desirable to reduce the number of the terms J and to increase B j by absolute value. The more detailed information about the Lehmer’s measure μ and its significance for efficient computation of π can be found in literature [7].
In our previous publication using de Moivre’s formula we derived the two-term Machin-like formula for π [15]
π 4 = 2 k 1 arctan 1 u 1 , k + arctan 1 sin 2 k 1 arctan 2 u 1 , k u 1 , k 2 1 cos 2 k 1 arctan 2 u 1 , k u 1 , k 2 1 ,
where u 1 , k can be chosen as an integer
u 1 , k = a k 2 a k 1 ,
such that a set of nested radicals a k can be computed as a k = 2 + a k 1 starting from a 0 = 0 .
In the recent publication the researcher(s) from the Wolfram Mathematica [17] demonstrated an example for computation of π as a rational fraction. In particular, it was shown that with integer constant u 1 , 1000 the constant π can be computed such that the ratio
π 4 2 999 u 1 , 1000
results in more than 300 correct decimal digits. However, the method of computation shown in [17] is based on Equation (5) that involves the nested radicals consisting of multiple square roots of 2 [18,19,20,21,22,23]. Although Equation (5) helps generate the required integers u 1 , k , it should not be generally used at larger values k since a function based on multiple square roots is not an elementary. Therefore, a simple method based on rational approximation would be preferable. In this work, we develop a new method of computation of the integer u 1 , k that excludes application of the set of nested radicals a k . This approach is simple and does not require any irrational (surd) numbers in computation.

2. Preliminaries

Suppose that
π 4 = α arctan 1 γ , α , γ R .
The simplest case when α = γ = 1 . However, there may be infinitely many identities of kind (6). Let us show the infinitude of this kind of formulas.
Theorem 1.
There are infinitely many numbers α and γ satisfying the relation (6).
Proof. 
The proof becomes straightforward by considering the following example
π 4 = 2 k 1 arctan 2 a k 1 a k , k Z , k 1 ,
where nested radicals are computed as a k = 2 + a k 1 at a 0 = 0 . Comparing Equations (6) with (7) immediately yields that α = 2 k 1 and γ = a k / 2 a k 1 . The derivation of Equation (7) is very simple and can be found in [14].    □
It is interesting to note that using Equation (7) one can easily prove the well-known Equation (8) for π below.
Theorem 2.
We have that
π = lim k 2 k 2 2 + 2 + 2 + k 1 square roots .
Proof. 
The following relation
lim k a k = 2 + 2 + 2 + 2
is a simplest Ramanujan’s nested radical [18,19,20,21,22,23]. Denote X as unknown, then from the relation
2 + 2 + 2 + 2 = X
it immediately follows that
2 + X = X
or
2 + X = X 2 .
Solving this equation yields two solutions for X that are 1 and 2. Since
0 < 2 < 2 + 2 < 2 + 2 + 2
all values of a k are non-negative and monotonically increase with increasing integer k. Therefore, excluding 1 from consideration we end up with a solution
lim k a k = 2 .
From this limit it immediately follows that
lim k 2 a k 1 = lim k 2 a k = 0 .
Consequently, the ratio 2 a k 1 / a k 0 as k .
The argument of the arctangent function in Equation (7) tends to zero as the integer k increases. Therefore, in accordance with relation (3) we can write
arctan 2 a k 1 a k 0 , 2 a k 1 a k 0 at k ,
from which it follows that
π 4 = lim k 2 k 1 arctan 2 a k 1 a k = lim k 2 k 1 2 a k 1 a k = lim k 2 k 2 2 a k 1
or
π = lim k 2 k 2 a k 1 .
   □
As we can see, this proof of Equation (8) is as easy as the one shown in [18]. We also note that the following limit that we used in the proof
π 4 = lim k 2 k 1 arctan 2 a k 1 a k
is valid since the identity (7) remains valid at any arbitrarily large positive integer k.
It is also easy to prove the infinitude of the Machin-like formulas (2) for π ; substituting x = 1 into the expansion series [24]
arctan x = n = 1 N arctan N x N 2 + n 1 n x 2 arctan N x = n = 1 N arctan x 1 + n 1 n x 2
we obtain the following identity [25]
π 4 = n = 1 N arctan N n 1 n + N 2
leading to
π 4 = arctan 1 , N = 1 ,
π 4 = arctan 1 3 + arctan 1 2 , N = 2 ,
π 4 = arctan 1 5 + arctan 3 11 + arctan 1 3 , N = 3 ,
π 4 = arctan 1 7 + arctan 2 11 + arctan 2 9 + arctan 1 4 , N = 4
and so on. Although the identity (9) shows infinitude of the Machin-like formulas for π , its number of the terms increases with increasing N. We can also show a simple proof for infinitude of the two-term Machin-like formulas for π .
Lemma 1.
For real α and β 1 , there are infinitely many two-terms Machin-like formulas for π of kind
π 4 = α arctan 1 β 1 + arctan 1 β 2 .
Proof. 
The Lemma 1 follows directly from the Theorem 1 that implies infinitude of equations of kind (6). In order to show this relation, we assume that α and γ in Equation (6) are both positive numbers and represent γ as a sum γ = ζ + δ , where δ is any small number that can be chosen arbitrarily such that γ > > δ . Thus, we can rewrite the Equation (6) in form
π 4 = α arctan 1 ζ + δ .
From the inequality γ > > δ it follows that ζ β . Therefore, we can approximate
arctan 1 γ arctan 1 ζ .
By introducing now an error term ε , we can infer that
arctan 1 ζ + δ = arctan 1 ζ + ε .
Consequently, we have
π 4 = α arctan 1 ζ + ε
or
π 4 = α arctan 1 ζ + arctan 1 η ,
where η is defined such that
arctan 1 η = ε .
The Equation (11) is of the same kind as that of given by Equation (10). This completes the proof since for any equation of kind (6) we can always construct an equation of kind (10).    □
When α and β 1 in Equation (10) are known, then the unknown value β 2 is given by
β 2 = 2 β 1 + i / β 1 i α i i .
The derivation of Equation (12) can be shown from the following identity
arctan 1 x = 1 2 i ln x + i x i
Thus, substituting this identity into Equation (10) results in
π 4 = α 2 i ln β 1 + i β 1 i + 1 2 i ln β 2 + i β 2 i
or
π 2 i = ln β 1 + i β 1 i α β 2 + i β 2 i .
Exponentiation on both sides leads to
β 1 + i β 1 i α β 2 + i β 2 i = i .
Solving this with respect to the constant β 2 leads to Equation (12).
Theorem 3.
If in Equation (10) k 2 the multiplier α = 2 k 1 and β 1 is a rational number greater than 1, then β 2 is also a rational number.
Proof. 
Define σ 1 and τ 1 such that
σ 1 = Re β 1 + i β 1 i = β 1 2 1 β 1 2 + 1
and
τ 1 = Im β 1 + i β 1 i = 2 β 1 β 1 2 + 1 .
Then, it is not difficult to see by induction that
σ 1 + i τ 1 2 k 1 = σ 1 + i τ 1 2 2 2 2 k 1 powers of 2 = σ 2 + i τ 2 2 2 2 2 k 2 powers of 2 = σ 3 + i τ 3 2 2 2 2 k 3 powers of 2 = = σ n + i τ n 2 2 2 2 k n powers of 2 = = σ k 2 + i τ k 2 2 2 = σ k 1 + i τ k 1 2 = σ k + i τ k ,
where by the following two-step iteration we have
σ n = σ n 1 2 τ n 1 2 τ n = 2 σ n 1 τ n 1 , n = 2 , 3 , 4 , , k .
Consequently, Equation (12) can be rewritten in form
β 2 = 2 σ k + i τ k i i = 2 σ k σ k 2 + τ k 1 2 + i 2 1 τ k σ k 2 + τ k 1 2 1 .
Applying the de Moivre’s formula we can separate the complex number σ 1 + i τ 1 2 k 1 into real and imaginary parts in polar form as
σ 1 + i τ 1 2 k 1 = σ 1 2 + τ 1 2 2 k 2 cos 2 k 1 Arg σ 1 + i τ 1 + i sin 2 k 1 Arg σ 1 + i τ 1 .
Substituting this expression into the Equation (15) after some trivial rearrangement we get
β 2 = cos 2 k 1 Arg β 1 + i β 1 i 1 sin 2 k 1 Arg β 1 + i β 1 i .
Since β 1 > 1 , then
Re β 1 + i β 1 i = β 1 2 1 β 1 2 + 1 > 1
and, therefore, the principal value argument can be replaced by the arctangent function as follows
Arg β 1 + i β 1 i = Arg β 1 2 1 β 1 2 + 1 + i 2 β 1 β 1 2 + 1 = arctan 2 β 1 β 1 2 + 1 / β 1 2 1 β 1 2 + 1 = arctan 2 β 1 β 1 2 1 .
Consequently, we can write
β 2 = cos 2 k 1 arctan 2 β 1 β 1 2 1 1 sin 2 k 1 arctan 2 β 1 β 1 2 1 .
As we can see from this equation, the constant β 2 R . This signifies that the imaginary part of Equation (15) must be equal to zero. Therefore, from Equation (15) we get
2 1 τ k σ k 2 + τ k 1 2 1 = 0 β 2 = σ k 1 τ k .
The values σ k and τ k are rational since, according to two-step iteration (14) all values σ n and τ n at any intermediate steps of iterations are rational. Therefore, the constant β 2 must be a rational number.    □
Consider two examples. Choosing α = 16 and β 1 = 509 / 25 = 20.36 and substituting these two values into Equation (12) we can find that
β 2 = 114322283895863787286174872158832679853761 19955894848381168459034791030978450561
The following Mathematica code:
\[Alpha]=16;
\[Beta]1=509/25;
\[Beta]2=114322283895863787286174872158832679853761/
19955894848381168459034791030978450561;
Pi/4==16*ArcTan[1/\[Beta]1]+ArcTan[1/\[Beta]2]
returns True. Choosing now, for example, α = 16 and β 1 = 407 / 20 = 20.35 and substituting these two values into Equation (12) again, we can get a negative value
β 2 = 817344423776293722798294452010774302554561 172199208235943812365929049219262848959 .
The following Mathematica code:
\[Alpha]=16;
\[Beta]1=407/20;
\[Beta]2=-817344423776293722798294452010774302554561/
172199208235943812365929049219262848959;
Pi/4==16*ArcTan[1/\[Beta]1]+ArcTan[1/\[Beta]2]
also validates the two-term Machin-like formula for π by returning True. The different signs in β 2 follow from the chosen integer α = 16 = 2 k 1 at k = 5 . When we take
β 1 = a 5 2 a 4 = 2 + 2 + 2 + 2 + 2 2 2 + 2 + 2 + 2 = 20.355467624987188 irrational ,
then the value of β 2 = 0 . However, if  β 1 < a k / 2 a k 1 , then β 2 < 0 and vice versa if β 1 > a k / 2 a k 1 , then β 2 > 0 . The examples above correspond to the following inequality
407 20 case β 2 < 0 < 2 + 2 + 2 + 2 + 2 2 2 + 2 + 2 + 2 case β 2 = 0 < 509 25 case β 2 > 0 .
Chien-Lih proposed a method showing how to reduce the Lehmer’s measure by using the Euler’s-type identity in an iteration for generating the two-term Machin-like formulas for π . However, our method of generating the two-term Machin-like formula for π based on the two-step iteration (14) is much easier than the method proposed by Chien-Lih in the work [26].

3. Derivation

Using Equation (16) we can rewrite the Equation (10) as
π 4 = 2 k 1 arctan 1 β 1 + arctan 1 sin 2 k 1 arctan 2 β 1 β 1 2 1 cos 2 k 1 arctan 2 β 1 β 1 2 1 .
In general, the constant β 1 may be either rational or irrational number. However, it is more convenient to apply notation u 1 , k that is defined by Equation (5) instead of β 1 . Such a notation is to emphasize that the constant u 1 , k is an integer dependent upon on k. Thus, with this notation the two-term Machin-like formula for π can be represented as
π 4 = 2 k 1 arctan 1 u 1 , k + arctan 1 u 2 , k ,
where in accordance with Equation (12) we have now
u 2 , k = 2 u 1 , k + i / u 1 , k i 2 k 1 i i .
It is interesting to note that by taking k = 3 , we get
u 1 , 3 = a 3 2 a 2 = 2 + 2 + 2 2 2 + 2 = 5 .
Substituting u 1 , 3 = 5 into Equation (17) we obtain u 2 , 3 = 239 . Considering that 2 k 1 = 2 2 = 4 and substituting these two constants into Equation (10) we derive an original Machin-like Formula (1) for π .
Since the value 2 k 1 rapidly increases with increasing k, application of the Equation (18) if not effective to compute the second constant u 2 , k . However, the two-step iteration (14) perfectly resolves this issue. Specifically, implying that the initial values for the two-step iteration (14) are
σ 1 = Re u 1 , k + i u 1 , k i = u 1 , k 2 1 u 1 , k 2 + 1
and
τ 1 = Im u 1 , k + i u 1 , k i = 2 u 1 , k u 1 , k 2 + 1 ,
we can find the second constant as
u 2 , k = σ k 1 τ k .
We can derive again the original Machin-like Formula (1) for π by using the two-step iteration (14) at k = 3 . This leads to the following
σ 1 = u 1 , 3 2 1 u 1 , 3 2 + 1 = 24 26 , τ 1 = 2 u 1 , 3 u 1 , 3 2 + 1 = 10 26 ,
σ 2 = σ 1 2 τ 1 2 = 119 169 , τ 2 = 2 σ 1 τ 1 = 120 169 ,
σ 3 = σ 2 2 τ 2 2 = 239 28561 , τ 3 = 2 σ 2 τ 2 = 28560 28561 .
Finally, using Equation (19) we can find the second constant to be
u 2 , 3 = σ 3 1 τ 3 = 239 / 28561 1 28560 / 28561 = 239 .
It should be noted that the second constant u 2 , k is an integer only at k = 2 and k = 3 . At  k > 3 it is not an integer but a rational number.
The next example is k = 6 . The first constant is an integer given by
u 1 , 6 = a 6 2 a 5 = 2 + 2 + 2 + 2 + 2 + 2 2 2 + 2 + 2 + 2 + 2 = 40 .
The second constant u 2 , 6 is a rational number that can be computed either by Equation (18) or, more efficiently, by two-step iteration (14)
u 2 , 6 = 2634699316100146880926635665506082395762836079845121 38035138859000075702655846657186322249216830232319 .
The following Mathematica code validates the two-term Machin-like formula for π at k = 6 :
k=6;
\[Beta]1=40;
\[Beta]2=-2634699316100146880926635665506082395762836079845121/
38035138859000075702655846657186322249216830232319;
Pi/4==2^(k-1)*ArcTan[1/\[Beta]1]+ArcTan[1/\[Beta]2]
by returning True.
Alternatively, the second constant can also be found by using the following identity in trigonometric form
u 2 , k = cos 2 k 1 arctan 2 u 1 , k u 1 , k 2 1 1 sin 2 k 1 arctan 2 u 1 , k u 1 , k 2 1
that follows from Equation (16). It should be noted that the constant u 2 , k must be a rational number as it has been shown by Theorem 3.
We can see that from Equation (5) it follows that
u 1 , k < < u 1 , k 2 , k > > 1 .
Consequently, the following ratio can be simplified as given by
2 u 1 , k u 1 , k 2 1 2 u 1 , k .
Replacing the arguments of the sine and cosine functions in Equation (20), we can approximate the two-term Machin-like Formula (17) for π as
π 4 2 k 1 arctan 1 u 1 , k + arctan 1 sin 2 k / u 1 , k cos 2 k / u 1 , k .
Using the identities for the double angle
sin x = 2 tan x / 2 1 + tan 2 x / 2 ,
cos x = 1 tan 2 x / 2 1 + tan 2 x / 2 ,
after some trivial rearrangements we obtain
π 4 2 k 1 arctan 1 u 1 , k + arctan 1 tan 2 k 1 / u 1 , k 1 + tan 2 2 k 1 / u 1 , k .
Recently, it has been noticed in publication [17] that the ratio 2 k 1 / u 1 , k approximates π / 4 reasonably well when integer k = 1000 . The following theorem shows why accuracy of this ratio improves with increasing k.
Theorem 4.
There is a limit
lim k 2 k 1 u 1 , k = π 4 .
Proof. 
By definition of the floor function we have
a k 2 a k 1 = a k 2 a k 1 + frac a k 2 a k 1 ,
where by definition the fractional part cannot be smaller than zero and greater than or equal to unity
0 frac a k 2 a k 1 < 1 .
Therefore, we can write
lim k a k / 2 a k 1 u 1 , k = lim k a k / 2 a k 1 a k / 2 a k 1 = lim k a k / 2 a k 1 + frac a k / 2 a k 1 a k / 2 a k 1 = 1 + lim k frac a k / 2 a k 1 a k / 2 a k 1 = 1 .
Since the fractional part cannot be smaller than 0 and greater than 1 we can conclude that
lim k a k / 2 a k 1 u 1 , k = 1 .
Consequently, we can infer that
lim k 2 k 1 2 a k 1 a k = lim k 2 k 1 u 1 , k .
From Theorem 2 we know that
lim k 2 a k 1 a k = lim k 2 a k 1 lim k a k = 0 2 = 0 .
Consequently, from the relation (3) we get
lim k 2 k 1 2 a k 1 a k = lim k 2 k 1 arctan 2 a k 1 a k = π 4
and the limit (22) follows.    □
Lemma 2.
There is a limit such that
lim k 1 u 2 , k = 0 .
Proof. 
We know that the limit
π 4 = lim k 2 k 1 arctan 1 u 1 , k + arctan 1 u 2 , k
is valid since the identity (17) remains valid at any arbitrarily large integer k. We also know that from the Theorem 4 and relation (3) it follows that
π 4 = lim k 2 k 1 u 1 , k = lim k 2 k 1 arctan 1 u 1 , k .
This signifies that
lim k 2 k 1 arctan 1 u 1 , k = lim k 2 k 1 arctan 1 u 1 , k + arctan 1 u 2 , k .
However, according to relation (3) this equation can be simplified as
lim k 2 k 1 u 1 , k = lim k 2 k 1 u 1 , k + 1 u 2 , k
and the proof follows.    □
Applying Theorem 4 to the left side of approximation (21) yields
2 k 1 u 1 , k 2 k 1 arctan 1 u 1 , k + arctan 1 tan 2 k 1 / u 1 , k 1 + tan 2 2 k 1 / u 1 , k .
or
u 1 , k 1 arctan 1 u 1 , k + 1 2 k 1 arctan 1 tan 2 k 1 / u 1 , k 1 + tan 2 2 k 1 / u 1 , k .
We note that both arguments of the arctangent function tend to zero with increasing k. Therefore, referring to the relation (3) again we can simplify the approximation above as
u 1 , k 1 1 u 1 , k + 1 tan 2 k 1 / u 1 , k 2 k 1 1 + tan 2 2 k 1 / u 1 , k .
Using the Theorem 4 it follows that at k
tan 2 2 k 1 u 1 , k tan 2 π 4 1 .
Consequently, the value
1 + tan 2 2 k 1 u 1 , k 2
with increasing k. This leads to
u 1 , k 1 1 u 1 , k + 1 2 k 1 tan 2 k 1 u 1 , k , k > > 1 .
Comparing Equations (17) and (21) one can see that
u 2 , k 1 + tan 2 2 k 1 / u 1 , k 1 tan 2 k 1 / u 1 , k , k > > 1
and due to relation (23) this approximation can be further simplified to
u 2 , k 2 1 tan 2 k 1 / u 1 , k , k > > 1 .
Although this equation only approximates the second constant u 2 , k , its accuracy, nevertheless, improves with increasing k. Perhaps, the approximation (25) can also be used at larger values of the integer k as an alternative to the exact Formula (19) based on the two-step iteration (14).
We can see consistency of the approximations (23) and (25) with Theorem 4 and Lemma 2. In particular, when k tends to infinity the constants u 1 , k and u 2 , k also tend to infinity. Therefore, in order to enhance a convergence rate, it is important to obtain the integer u 1 , k in the two-term Machin-like Formula (17) for π as large as possible. Once the value of the first constant u 1 , k is determined, the second constant u 2 , k can be computed by using Equation (19) based on two-step iteration Formula (14). For example, at  k = 27 the value u 1 , 27 = 85,445,659. The corresponding Lehmer’s measure is μ 0.245319 only. Such a small Lehmer’s measure implies a rapid convergence rate. In particular, we can observe 16 correct decimal digits of π per term increment. This can be confirmed by running a Mathematica program provided in [27].
At k = 27 Equation (19) yields a rational number u 2 , 27 consisting of 522,185,807 digits in numerator and 522,185,816 digits in denominator. Such a quotient with huge numbers in numerator and denominator is not unusual and can also be observed in Borwein integrals. Specifically, Bäsel and Baillie in their work [28] showed that a formula for π can be generated with a quotient consisting of 453,130,145 and 453,237,170 digits in its numerator and denominator, respectively. The interested readers can download the exact number u 2 , 27 with all digits from [29].

4. Implementation

At first glance, the approximation (24) does not look interesting as its both sides contain the constant u 1 , k and it is unclear how to represent it in explicit form. However, sample computations we performed with this approximation show that it can be implemented effectively. In particular, we noticed that application of approximation (24) in iteration provides a result that tends to be more accurate with increasing the integer k.
Consider for example k = 10 . In this case we have that
u 1 , 10 = a 10 2 a 9 = 651 .
With initial guess for u 1 , 10 , say 1000, after just 5 iterations (self-substitutions) we obtain
u 1 , 10 651.899 .
This can be seen by running the following Mathematica command lines that show the results of computation based on this iteration:
k=10;
a[1]=Sqrt[2];
a[n_]:=a[n]=Sqrt[2+a[n-1]];
Print["Exact value: ",Floor[a[10]/Sqrt[2-a[9]]]];
u2k:=1000;
itr=1;
Print["Initial guess value: ",u2k];
Print["--------------------------"];
Print["Iteration    ","Approximation"];
Print["-------------- -----------"];
While[itr<=5,u2k=1/(1/u2k+1/2^k (1-Tan[2^(k-1)/u2k]));
  Print[itr,"          ",u2k//N];itr++];
The Mathematica generates the following output:
Exact value: 651
Initial guess value: 1000
--------------------------
Iteration    Approximation
--------------------------
1            700.404
2            654.196
3            651.905
4            651.899
5            651.899
We have ceased the iterative process after 5-th cycle since two successive numbers coincide with each other at fourth and fifth iterations with same output 651.899 .
Application of the Equation (24) is convenient since for each consecutive increment of the integer k the following inequality remains valid
2 u 1 , k u 1 , k + 1 2 u 1 , k + 1 .
This inequality follows from the property of the floor function that is used in Equation (5); the constant u 1 , k + 1 should be either equal to 2 u 1 , k or larger it by unity (see [17] for some examples). Thus, based on Equation (24) and inequality (26) we can make the following assumption
u 1 , k + 1 = 2 · 1 1 u 1 , k + 1 2 k 1 tan 2 k 1 / u 1 , k .
The computational tests we performed shows that this formula provides correct results for a large range of the integer k 2 . However, its general applicability for any arbitrarily large k yet to be proved.
There are different methods to approximate the tangent function in Equation (27). One of the ways is to truncate the following expansion series
tan x = n = 1 1 n 1 2 2 n 2 2 n 1 B 2 n 2 n ! x 2 n 1 = x + x 3 3 + 2 x 5 15 + 17 x 7 315 + 62 x 9 2835 + tan x = x + O x 3 ,
where B n are the Bernoulli numbers, defined by a contour integral
B n = n ! 2 π i z e z 1 d z z n + 1 .
Although this series expansion is rapid in convergence, its application may not be optimal since it requires the determination of the Bernoulli numbers. One of the ways to compute them is given by the following identity
B n = m = 0 n 1 m + 1 = 0 m 1 m n .
We can see that this formula involves the double summation and, therefore, cannot be rapid in principle especially at larger orders of n. Although other methods of computation of the Bernoulli numbers are more efficient, their implementations require quite sophisticated algorithms [30,31,32].
Alternatively, the tangent function may also be computed by using continued fractions [33,34,35]. However, algorithmic implementation of the continued fractions may not be optimal for our particular task.
This problem can be resolved by noticing that at each consecutive step of iteration the integer u 1 , k increases, and because of this the argument of the tangent function decreases. Consequently, it may be reasonable to utilize argument reduction method for computation of the tangent function [36]. As a simplest case we can use, for example, the double angle identity providing argument reduction by a factor of two
tan 2 x = 2 tan x 1 tan 2 x .
Therefore, taking into account that in accordance with (28) tan x x at x 0 , we can approximate the double angle identity above as
tan 2 x 2 x 1 x 2 , x < < 1 .
This approximation implies that the arctangent function can be calculated in a simple iteration over and over again by defining the following function
f n x = 2 f n 1 x 1 f n 1 2 x tan 2 n x ,
where
f 1 x = 2 x 1 x 2 .
Tangent function can be computed more accurately by defining
f 1 x = 2 x + x 3 / 3 1 x + x 3 / 3 2
since according to expansion series (28) we can also infer that tan x = x + x 3 / 3 + O x 5 .
The following Mathematica command lines execute the program for computation of the integer constant u 1 , k by using Equations (27) and (29):
(* Clear previous value *)
Clear[\[Beta]1];
(* Set of nested radicals *)
a[0]=0;a[k_]:=a[k]=Sqrt[2+a[k-1]];
(* Equation (5) *)
\[Beta]1[k_]:=\[Beta]1[k]=Floor[a[k]/Sqrt[2-a[k-1]]];
(* Applying Equation (29) in iteration *)
f[x_,1]:=f[x,1]=SetPrecision[(2*x)/(1-x^2),k];
f[x_,n_]:=f[x,n]=(2*f[x,n-1])/(1-f[x,n-1]^2);
(*Main computation*)
func[u1_,k_]:=func[u1,k]=1/(1/u1+1/2^k*(1-f[1/u1,k-1]));
k=2; (* iteger k *)
fstConst=2; (* first constant *)
kMax=30; (* max number for iteration *)
str={{"Integer k","  |  ","Equation (5)","  |  ","Equation (27)"}}; (* string *)
While[k<=kMax,AppendTo[str,{k,"  |  ",\[Beta]1[k],"  |  ",fstConst}];
    fstConst=Floor[func[2*fstConst,k+1]];k++];
Print[TableForm[str]];
The Mathematica generates the following table:
Integer k  |  Equation (5)  |  Equation (27)
2  |  2  |  2
3  |  5  |  5
4  |  10  |  10
5  |  20  |  20
6  |  40  |  40
7  |  81  |  81
8  |  162  |  162
9  |  325  |  325
10  |  651  |  651
11  |  1303  |  1303
12  |  2607  |  2607
13  |  5215  |  5215
14  |  10430  |  10430
15  |  20860  |  20860
16  |  41721  |  41721
17  |  83443  |  83443
18  |  166886  |  166886
19  |  333772  |  333772
20  |  667544  |  667544
21  |  1335088  |  1335088
22  |  2670176  |  2670176
23  |  5340353  |  5340353
24  |  10680707  |  10680707
25  |  21361414  |  21361414
26  |  42722829  |  42722829
27  |  85445659  |  85445659
28  |  170891318  |  170891318
29  |  341782637  |  341782637
30  |  683565275  |  683565275
Thus, we can see the feasibility of computation of the constant u 1 , k without any irrational (surd) numbers. Just by applying only arithmetic manipulations (summations, multiplications and divisions) we can compute the integer u 1 , k by iteration based on Equation (27).

5. Quadratic Convergence to π

There is another interesting application of Equation (24). In particular, we found experimentally that the following formula defined by iteration
θ n + 1 = 1 1 θ n + 1 2 k 1 tan 2 k 1 θ n ,
leads to a quadratic convergence to the constant π such that (by assumption)
π = lim n 2 k + 1 θ n , k 1 .
The quadratic convergence to π can be observed by running the command lines:
Clear[k,\[Theta]]
k=7;(* assign value of k *)
\[Theta]=2^k;(* initial guess *)
str={{"Iteration No."," | ","Computed digits of \[Pi]"}};(* string *)
If[k>17,Print["Please wait. Computing..."]];
(* Equation (30) used in iteration *)
For[n=1,If[k<15,n<=15,n<=k],n++,\[Theta]=SetPrecision[1/(1/\[Theta]+
    1/2^k*(1-Tan[2^(k-1)/\[Theta]])),2^(n+1)];AppendTo[str,
        {n," | ",MantissaExponent[Pi-2^(k+1)/\[Theta]][[2]]//Abs}]];
Print[str//TableForm];
The output of Mathematica is the following table:
Iteration No.  |  Computed digits of π
1  |  0
2  |  1
3  |  4
4  |  9
5  |  19
6  |  39
7  |  79
8  |  159
9  |  319
10  |  639
11  |  1278
12  |  2558
13  |  5116
14  |  10233
15  |  20468
As we can see from this table, after third iteration the number of correct digits of π increases by factor of two at each consecutive step of iteration.
More explicitly, the dynamics of computation of π can be seen by running the following Mathematica code:
Clear[k,\[Theta]]
k=7;(*assign value of k*)
\[Theta][0]:=2^k;(*initial guess*)
(* Iteration formula (30) *)
\[Theta][n_]:=1/(1/\[Theta][n-1]+1/2^k*(1-Tan[2^(k-1)/\[Theta][n-1]]));
(* Approximated value of \[Pi] *)
piAppr[n_]:=2^(k+1)/\[Theta][n];
Print["Iteration 1"];
Print[N[piAppr[1],25],"..."];
Print["Iteration 2"];
Print[N[piAppr[2],25],"..."];
Print["Iteration 3"];
Print[N[piAppr[3],25],"..."];
Print["Iteration 4"];
Print[N[piAppr[4],25],"..."];
Print["Iteration 5"];
Print[N[piAppr[5],25],"..."];
Print["------------------"];
Print["Actual value of \[Pi]"];
Print[N[Pi,25],"..."];
Mathematica returns the following output:
Iteration 1
2.907395020312418973489641...
Iteration 2
3.128878092399718501843067...
Iteration 3
3.141552409181815125317050...
Iteration 4
3.141592653184895576712223...
Iteration 5
3.141592653589793238421658...
Actual value of  π
3.141592653589793238462643...
As we can see, the first five iterations provide 0, 1, 4, 9 and 19 correct decimal digits of π , respectively. The actual value of π , generated by Mathematica built-in function, is also shown for comparison.
The quadratic convergence to π can be implemented by using the Brent–Salamin algorithm [37,38,39,40] (It is also known as the Gauss–Brent–Salamin algorithm). However, in contrast to the Brent–Salamin algorithm the proposed iteration Formula (30) provides quadratic convergence to π without any irrational (surd) numbers.

6. Conclusions

In this work we propose a method for determination of the integer u 1 , k . In particular, the algorithmic implementation of the Formula (27) shows that it can be used as an alternative to Equation (5) requiring a set of the nested radicals a k defined as a k = 2 + a k 1 and a 1 = 0 . This method is based on a simple iteration and can be implemented without any irrational (surd) numbers.

Author Contributions

S.M.A. performed data analysis and wrote the manuscript. R.K.J., R.S. and B.M.Q. performed data analysis. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

This work is supported by National Research Council Canada, Thoth Technology Inc., York University and Epic College of Technology.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Beckmann, P. A History of pi; Golem Press: Boulder, CO, USA, 1971. [Google Scholar]
  2. Berggren, L.; Borwein, J.; Borwein, P. Pi: A Source Book, 3rd ed.; Springer: New York, NY, USA, 2004. [Google Scholar]
  3. Borwein, J.; Bailey, D. Mathematics by Experiment. Plausible Reasoning in the 21st Century, 2nd ed.; Taylor & Francis Group: Boca Raton, FL, USA, 2008. [Google Scholar]
  4. Nelsen, R.B. A geometric proof of Machin’s formula. Math. Mag. 1990, 63, 336–337. [Google Scholar] [CrossRef]
  5. Popescu, S.A.; Peled, A. New Geometrical Derivations of Machin Type Equation. Gen. Sci. J. 2021. Available online: https://www.gsjournal.net/Science-Journals/ResearchPapers-Mathematics andAppliedMathematics/Download/8842 (accessed on 18 July 2021).
  6. Lehmer, D.H. On arccotangent relations for π. Amer. Math. Mon. 1938, 45, 657–664. [Google Scholar] [CrossRef]
  7. Wetherfield, M. The enhancement of Machin’s formula by Todd’s process. Math. Gazette 1996, 80, 333–344. [Google Scholar] [CrossRef]
  8. Chien-Lih, H. More Machin-type identities. Math. Gaz. 1997, 81, 120–121. [Google Scholar] [CrossRef]
  9. Identity Lists—Classification, Layout and Links. Available online: www.machination.eclipse.co.uk/IdLists.html (accessed on 18 July 2021).
  10. Arctan Relations for Pi. Available online: www.jjj.de/arctan/arctanpage.html (accessed on 18 July 2021).
  11. Agarwal, R.P.; Agarwal, H.; Sen, K.S. Birth, growth and computation of pi to ten trillion digits. Adv. Differ. Equ. 2013, 100. [Google Scholar] [CrossRef] [Green Version]
  12. Calcut, J.S. Gaussian integers and arctangent identities for π. Amer. Math. Mon. 2009, 116, 515–530. [Google Scholar] [CrossRef]
  13. Chien-Lih, H. An elementary derivation of Euler’s series for the arctangent function. Math. Gaz. 2005, 89, 469–470. [Google Scholar] [CrossRef]
  14. Abrarov, S.M.; Quine, B.M. A formula for pi involving nested radicals. Ramanujan J. 2018, 46, 657–665. [Google Scholar] [CrossRef] [Green Version]
  15. Abrarov, S.M.; Quine, B.M. An iteration procedure for a two-term Machin-like formula for pi with small Lehmer’s measure. arXiv 2017, arXiv:1706.08835. [Google Scholar]
  16. Tweddle, I. John Machin and Robert Simson on inverse-tangent series for π. Arch. Hist. Exact Sci. 1991, 42, 1–14. [Google Scholar] [CrossRef]
  17. Wolfram Cloud. A Wolfram Notebook Playing with Machin-like Formulas. Available online: https://develop.open.wolframcloud.com/objects/exploration/MachinLike.nb (accessed on 18 July 2021).
  18. Herschfeld, A. On infinite radicals. Amer. Math. Mon. 1935, 42, 419–429. [Google Scholar] [CrossRef]
  19. Borwein, J.M.; de Barra, G. Nested radicals. Amer. Math. Mon. 1991, 98, 735–739. [Google Scholar] [CrossRef]
  20. Servi, L.D. Nested square roots of 2. Amer. Math. Mon. 2003, 110, 326–330. [Google Scholar] [CrossRef]
  21. Levin, A. A new class of infinite products generalizing Viète’s product formula for π. Ramanujan J. 2005, 10, 305–324. [Google Scholar] [CrossRef]
  22. Rao, K.S.; Berghe, G.V. On an entry of Ramanujan in his Notebooks: A nested roots expansion. J. Comput. Appl. Math. 2005, 173, 371–378. [Google Scholar] [CrossRef]
  23. Kreminski, R. π to thousands of digits from Vieta’s formula. Math. Mag. 2008, 81, 201–207. [Google Scholar] [CrossRef]
  24. Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. Unconditional applicability of Lehmer’s measure to the two-term Machin-like formula for π. Math. J. 2021. [Google Scholar] [CrossRef]
  25. OEIS. Numerators in a Set of Expansions of the Single-Term Machin-like Formula for Pi. Available online: https://oeis.org/A338878 (accessed on 18 July 2021).
  26. Chien-Lih, H. Some observations on the method of arctangents for the calculation of π. Math. Gaz. 2004, 88, 270–278. [Google Scholar] [CrossRef]
  27. Abrarov, S.M.; Quine, B.M. Efficient computation of pi by the Newton–Raphson iteration and a two-term Machin-like formula. Int. J. Math. Comput. Sci. 2018, 13, 157–169. Available online: http://ijmcs.future-in-tech.net/13.2/R-Abrarov.pdf (accessed on 18 July 2021).
  28. Bäsel, U.; Baillie, R. Sinc integrals and tiny numbers. Elem. Math. 2016, 71, 7–20. [Google Scholar] [CrossRef] [Green Version]
  29. Abrarov, S.M.; Quine, B.M. The Rational Number u2 for the two-term Machin-like formula for pi computed by iteration. Available online: http://hdl.handle.net/10315/33173 (accessed on 18 July 2021).
  30. Knuth, D.E.; Buckholtz, T.J. Computation of tangent, Euler, and Bernoulli numbers. Math. Comp. 1967, 21, 663–688. [Google Scholar] [CrossRef]
  31. Koepf, W. Power series in computer algebra. J. Symb. Comput. 1992, 13, 581–603. [Google Scholar] [CrossRef] [Green Version]
  32. Harvey, D. A multimodular algorithm for computing Bernoulli numbers. Math. Comp. 2010, 79, 2361–2370. [Google Scholar] [CrossRef] [Green Version]
  33. Trott, M. Wolfram Demonstrations Project. Available online: https://demonstrations.wolfram.com/ContinuedFractionApproximationsOfTheTangentFunction/ (accessed on 18 July 2021).
  34. Havil, J. The Irrationals: A Story of the Numbers You Can’t Count On; Princeton University Press: Princeton, NJ, USA, 2012. [Google Scholar]
  35. Oliver, K.; Prodinger, H. The continued fraction expansion of Gauss’ hypergeometric function and a new application to the tangent function. Trans. R. Soc. S. Afr. 2012, 67, 151–154. [Google Scholar] [CrossRef]
  36. Beebe, N.H.F. The Mathematical-Function Computation Handbook; Springer International Publishing AG: New York, NY, USA, 2017. [Google Scholar]
  37. Brent, R.P. Fast multiple-precision evaluation of elementary functions. J. ACM 1976, 23, 242–251. [Google Scholar] [CrossRef] [Green Version]
  38. Salamin, E. Computation of π using arithmetic-geometric mean. Math. Comput. 1976, 30, 565–570. [Google Scholar] [CrossRef]
  39. Newman, D.J. A simplified version of the fast algorithms of Brent and Salamin. Math. Comput. 1985, 44, 207–210. [Google Scholar] [CrossRef]
  40. Lord, N.J. Recent calculations of π: The Gauss-Salamin algorithm. Math. Gaz. 1992, 76, 231–242. [Google Scholar] [CrossRef]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. Algorithmic Determination of a Large Integer in the Two-Term Machin-like Formula for π. Mathematics 2021, 9, 2162. https://doi.org/10.3390/math9172162

AMA Style

Abrarov SM, Jagpal RK, Siddiqui R, Quine BM. Algorithmic Determination of a Large Integer in the Two-Term Machin-like Formula for π. Mathematics. 2021; 9(17):2162. https://doi.org/10.3390/math9172162

Chicago/Turabian Style

Abrarov, Sanjar M., Rajinder K. Jagpal, Rehan Siddiqui, and Brendan M. Quine. 2021. "Algorithmic Determination of a Large Integer in the Two-Term Machin-like Formula for π" Mathematics 9, no. 17: 2162. https://doi.org/10.3390/math9172162

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop