Application of a New Iterative Formula for Computing π and Nested Radicals with Roots of 2
Abstract
1. Introduction
2. Preliminaries
| (* Define long string *) longStr = StringJoin["11757386816817535293027775284419412676", "7991915008537018836932014293678271636885792397"]; (* Computing the coefficient *) coeff = (10 + I)^8*(84 + I)^-1*(21342 + I)^-1*(991268848 + I)^-1* (193018008592515208050+I)^-1* (197967899896401851763240424238758988350338 + I)^-1* (FromDigits[longStr]+I)^-1; Print[Re[coeff] == Im[coeff]]; |
- by returning the output True.
3. An Iterative Formula to Compute
4. Approximation Methodologies
4.1. A Rational Approximation of
| Clear[k, c, flNum, accNum, v1, vk]; (* Integer k *) k = 3000; (* Use if needed: $RecursionLimit = 100000; *) $RecursionLimit = 50000; c[0] := c[0] = 0; c[n_] := c[n] = SetAccuracy[Sqrt[2 + c[n - 1]], k]; (* Floor number *) flNum = Floor[c[k]/Sqrt[2 - c[k - 1]]]; (* Accuracy number *) accNum = Length[RealDigits[flNum][[1]]]; (* Coefficient v_1 *) v1 = SetAccuracy[flNum, 2*accNum]; Print["At k = ", k, " number of digits of \[Pi] with single term: ", MantissaExponent[\[Pi] - 4 (2^(k - 1)/v1)][[2]] // Abs]; (* Compute coefficient v_k *) vk = v1; Do[vk = 1/2*(vk - 1/vk), k - 1]; Print["At k = ", k, " number of digits of \[Pi] with two terms: ", MantissaExponent[\[Pi] - 4 (2^(k - 1)/v1 + (vk - 1)/2)][[2]] //Abs]; |
- At k = 3000 number of digits of with single term: 902
- At k = 3000 number of digits of with two terms: 1805
4.2. An Approximation of with Cubic Convergence
| Clear[a, accNum, n]; (* Initial accuracy number *) accNum = 10; (* Initial value of À/2 *) a = SetAccuracy[3.145926/2, accNum]; Print["--------------------------------------"]; Print["Iteration n", " | ", "Number of digits of À"]; Print["--------------------------------------"]; (* Iteration *) For[n = 1, n <= 8, a = SetAccuracy[a + Cos[a], accNum]; Print[n, " | ", MantissaExponent[Pi - 2*a][[2]]//Abs]; accNum = 5*accNum; n++]; Print["--------------------------------------"]; |
- shows that the iterative Formula (36) provides cubic convergence since the number of digits of increases by a factor of 3 after each iteration.
4.3. A Numerical Solution for Nested Radicals with Roots of 2
| Clear[k, c, flNum, accNum, v] (*Assign value of k*) k = 5000; (* Increase if needed: $RecursionLimit = 100000; *) $RecursionLimit = 50000; (* Define nested radicals *) c[0] := c[0] = 0; c[n_] := c[n] = SetAccuracy[Sqrt[2 + c[n - 1]], k]; (* Compute floor number *) flNum = Floor[c[k]/Sqrt[2 - c[k - 1]]]; (*Set accuracy with accuracy number*) accNum = Length[RealDigits[flNum][[1]]]; (*Compute v_k*) v[1] := v[1] = SetAccuracy[Floor[flNum], accNum]; v[n_] := v[n] = 1/2*(v[n - 1] - 1/v[n - 1]); Print[MantissaExponent[v[k]/v[k - 3] - Sqrt[2 - c[3]]/c[4]][[2]] // Abs, " computed digits of nested radical"]; |
- 1506 computed digits of nested radical
| Print["Computed square root of 2 is ", N[1 + v[k]/v[k - 1], 20],"..."]; Print[MantissaExponent[(v[k]/v[k - 1] + 1) - Sqrt[2]][[2]] // Abs, " computed digits of square root of 2"]; |
- Computed square root of 2 is 1.4142135623730950488…
- 1506 computed digits of square root of 2
4.4. Computation via Arbitrary-Precision Arithmetic
| Clear[k, accNum, c, v1, vk, n]; (* Integer k *) k = 50; (* Define array of accuracy numbers *) accNum = {100000, 200000, 300000, 400000, 500000}; (* Define nested radicals *) c[0] := c[0] = 0; c[n_] := c[n] = SetAccuracy[Sqrt[2 + c[n - 1]], k]; n = 1; Do[ (* Setting accuracy *) v1 = SetAccuracy[Floor[c[k]/Sqrt[2 - c[k - 1]]], accNum[[n]]]; (* Computing v_k *) vk = v1; Do[vk = 1/2*(vk - 1/vk), k - 1]; Print["n = ", n, ", ", MantissaExponent[\[Pi] - 4*(2^(k - 1)*ArcTan[1/v1] + ArcTan[(vk - 1)/(vk + 1)])][[2]] // Abs, " digits of À"]; n++, 5]; |
- n = 1, 100014 digits of π
- n = 2, 200014 digits of π
- n = 3, 300014 digits of π
- n = 4, 400014 digits of π
- n = 5, 500014 digits of π
- accNum = {100000, 200000, 300000, 400000, 500000};
- If we increase these numbers, the number of correct digits of increases by the same factors. From this example, we can see that by increasing the parameters in the list variable accNum, we can archive an arbitrary convergence rate.
5. Determination of the Constant
| Clear[t, k, c, alpha, kappa, lambda, theta, str]; t = AbsoluteTiming[k = 19; (* Nested radicals with roots of 2 *) c[0] := c[0] = 0; c[n_] := c[n] = Sqrt[2 + c[n - 1]]; (* First coefficient *) alpha = Floor[c[k]/Sqrt[2 - c[k - 1]]]; (* Initial values for two-step iteration *) kappa = (alpha^2 - 1)/(alpha^2 + 1); lambda = (2*alpha)/(alpha^2 + 1); Print["Computing, please wait..."]; (* Two-step iteration *) Do[x = kappa^2 - lambda^2; y = 2*kappa*lambda; kappa = x; Clear[x]; lambda = y; Clear[y], k - 1]; theta = kappa/(1 - lambda);][[1]]; (* Converting to stings *) strNumer = ToString[Numerator[theta]]; strDenom = ToString[Denominator[theta]]; Print["At k = ", k," the run-time is ", t," seconds"] (* String for second coefficient *) str = ToString[Subscript[\[Theta], 1, k], StandardForm]; (* Formatting output *) If[k <= 5, Print[str," = ", theta], Print[str," = ", -StringJoin[StringPart[strNumer, 2 ;; 11], "...", StringPart[strNumer,-10 ;; -1]]/StringJoin[StringPart[strDenom, 2 ;; 11], "..." , StringPart[strDenom, -10 ;; -1]]]]; |
- This code returns the following output:
- Computing, please wait…
- —————————————–—————————————–———————–
- —————————————–—————————————–———————–
- At k = 19 the run-time is 10.3824 s
- Thus, this code takes about 10 s to generate the constant for Formula (38).
| Clear[t, k, c, v, theta, str]; t = AbsoluteTiming[k = 19; (* Nested radicals with roots of 2 *) c[0] := c[0] = 0; c[n_] := c[n] = Sqrt[2 + c[n - 1]]; (* First coefficient *) v = Floor[c[k]/Sqrt[2 - c[k - 1]]]; Print["Computing, please wait..."]; (* New iterative formula *) Do[v = 1/2*(v - 1/v), k - 1]; theta = (v + 1)/(v - 1);][[1]]; (* Converting to stings *) strNumer = ToString[Numerator[theta]]; strDenom = ToString[Denominator[theta]]; Print["At k = ", k," the run-time is ", t," seconds"] (* String for second coefficient *) str = ToString[Subscript[\[Theta], 1, k], StandardForm]; (* Formatting output *) If[k <= 5, Print[str," = ",theta], Print[str," = ", -StringJoin[StringPart[strNumer, 2 ;; 11], "...", StringPart[strNumer,-10 ;; -1]]/StringJoin[StringPart[strDenom, 2 ;; 11], "..." , StringPart[strDenom,-10 ;; -1]]]]; |
- Computing, please wait…
- —————————————–—————————————–———————–
- —————————————–—————————————–———————–
- At k = 19 the run-time is 1.98505 s
- This code generates the same constant after around 2 s. As we can see, the implementation of the new iterative Formula (23) performs 5 times faster.
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Beckmann, P. A History of Pi; Golem Press: New York, NY, USA, 1971. [Google Scholar]
- Berggren, L.; Borwein, J.; Borwein, P. Pi: A Source Book, 3rd ed.; Springer: New York, NY, USA, 2004. [Google Scholar]
- Borwein, J.; Bailey, D. Mathematics by Experiment—Plausible Reasoning in the 21st Century, 2nd ed.; Taylor & Francis Group: Abingdon, UK, 2008. [Google Scholar]
- Agarwal, R.P.; Agarwal, H.; Sen, S.K. Birth, growth and computation of pi to ten trillion digits. Adv. Differ. Equ. 2013, 2023, 100. [Google Scholar] [CrossRef]
- Lehmer, D.H. On arccotangent relations for π. Amer. Math. Monthly. 1938, 45, 657–664. [Google Scholar] [CrossRef]
- Wetherfield, M. The enhancement of Machin’s formula by Todd’s process. Math. Gaz. 1996, 80, 333–344. [Google Scholar] [CrossRef]
- Gasull, A.; Luca, F.; Varona, J.L. Three essays on Machin’s type formulas. Indag. Math. 2023, 34, 1373–1396. [Google Scholar] [CrossRef]
- Calcut, J.S. Gaussian integers and arctangent identities for π. Amer. Math. Mon. 2009, 116, 515–530. [Google Scholar] [CrossRef]
- Chien-Lih, H. More Machin-type identities. Math. Gaz. 1997, 81, 120–121. [Google Scholar] [CrossRef]
- Nimbran, A.S. On the derivation of Machin-like arctangent identities for computing pi (π). Math. Stud. 2010, 79, 171–186. [Google Scholar]
- Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. An iterative method for computing π by argument reduction of the tangent function. Math. Comput. Appl. 2024, 29, 17. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Quine, B.M. An iteration procedure for a two-term Machin-like formula for pi with small Lehmer measure. arXiv 2017, arXiv:1706.08835. [Google Scholar]
- The On-Line Encyclopedia of Integer Sequences. OEIS: A024810. Available online: https://oeis.org/A024810 (accessed on 25 October 2025).
- Campbell, J. Nested radicals obtained via the Wilf–Zeilberger method and related results. Maple Trans. 2023, 3, 16011. [Google Scholar] [CrossRef]
- Maritz, M.F. Extracting pi from chaos. Coll. Math. J. 2024, 55, 86–99. [Google Scholar] [CrossRef]
- Spíchal, L. Using the golden section to approximate π. Math. Mag. 2024, 97, 315–320. [Google Scholar] [CrossRef]
- Alferov, O. A rapidly converging Machin-like formula for π. arXiv 2024, arXiv:2403.09654. [Google Scholar]
- Kristiansen, T.B. On Machin-like Formula of Arbitrary Lehmer Measure. Two Essays on the Computation of π by Inverse Trigonometric Functions. Master’s Thesis, Norvegian University of Science and Technology, Trondheim, Norway, 2025. Available online: https://ntnuopen.ntnu.no/ntnu-xmlui/handle/11250/3200678 (accessed on 25 October 2025).
- Campbell, J.M. An iterative approach toward hypergeometric accelerations. arXiv 2025, arXiv:2505.14392. [Google Scholar] [CrossRef]
- Cho, S.; Kang, D.; Kim, R.; Lee, J.; Zhu, J. Chebyshev polynomials boost the π-series convergence. J. Korean Phys. Soc. 2025, 86, 1025–1036. [Google Scholar] [CrossRef]
- Spíchal, L. Approximation of the value of π using metallic means and the unit hyperbola. Math. Gaz. 2025, 109, 193–198. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. A new form of the Machin-like formula for π by iteration with increasing integers. J. Integer Seq. 2022, 25, 22.4.5. Available online: https://cs.uwaterloo.ca/journals/JIS/VOL25/Abrarov/abrarov5.html (accessed on 3 November 2025).
- Störmer, C. Solution complète en nombres entiers de l’équation m arctan . Bull. Soc. Math. Fr. 1899, 27, 160–170. [Google Scholar] [CrossRef][Green Version]
- Chien-Lih, H. An elementary derivation of Euler’s series for the arctangent function. Math. Gaz. 2005, 89, 469–470. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. A generalized series expansion of the arctangent function based on the enhanced midpoint integration. AppliedMath 2023, 3, 395–405. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. A rational approximation of the two-term Machin-like formula for π. AppliedMath 2024, 4, 868–888. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Quine, B.M. A formula for pi involving nested radicals. Ramanujan J. 2018, 46, 657–665. [Google Scholar] [CrossRef]
- Borwein, J.M.; Borwein, P.B. Cubic and higher order algorithms for π. Canad. Math. Bull. 1984, 29, 436–443. [Google Scholar] [CrossRef]
- Borwein, J.M.; Borwein, P.B. An explicit cubic iteration for π. BIT Numer. Math. 1986, 26, 123–126. [Google Scholar] [CrossRef]
- Nimbran, A.S. Extending Euler’s product for . Indian J. Pure Appl. Math. 2016, 47, 697–703. [Google Scholar] [CrossRef]
- Priestley, W.M. From square roots to n-th roots: Newton’s method in disguise. Coll. Math. J. 1999, 30, 387–388. [Google Scholar] [CrossRef]
- Kaushik, K.; Murphy, T. David Weed. Computing with FRACTRAN. TRAN. Irish Math. Soc. Bulletin. 2025, 95, 23–34. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Quine, B.M. A set of the Viète-like recurrence relations for the unity constant. arXiv 2017, arXiv:1702.00901. [Google Scholar] [CrossRef]
- Servi, L.D. Nested square roots of 2. Amer. Math. Mon. 2003, 110, 326–330. [Google Scholar] [CrossRef]
- Zimmerman, S.; Ho, C. On infinitely nested radicals. Math. Mag. 2008, 81, 3–15. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. Application of a New Iterative Formula for Computing π and Nested Radicals with Roots of 2. AppliedMath 2025, 5, 156. https://doi.org/10.3390/appliedmath5040156
Abrarov SM, Siddiqui R, Jagpal RK, Quine BM. Application of a New Iterative Formula for Computing π and Nested Radicals with Roots of 2. AppliedMath. 2025; 5(4):156. https://doi.org/10.3390/appliedmath5040156
Chicago/Turabian StyleAbrarov, Sanjar M., Rehan Siddiqui, Rajinder Kumar Jagpal, and Brendan M. Quine. 2025. "Application of a New Iterative Formula for Computing π and Nested Radicals with Roots of 2" AppliedMath 5, no. 4: 156. https://doi.org/10.3390/appliedmath5040156
APA StyleAbrarov, S. M., Siddiqui, R., Jagpal, R. K., & Quine, B. M. (2025). Application of a New Iterative Formula for Computing π and Nested Radicals with Roots of 2. AppliedMath, 5(4), 156. https://doi.org/10.3390/appliedmath5040156

