{
  "id": "chudnovsky-algorithm",
  "title": "Chudnovsky algorithm",
  "lang": "en",
  "source_lang": "en",
  "summary": "The Chudnovsky algorithm computes π using a rapidly convergent infinite series that yields about 14 decimal digits per term and supports efficient high-precision evaluation.",
  "category": "mathematics",
  "subcategory": "applied",
  "type": "concept",
  "aliases": [
    "Chudnovsky formula",
    "Chudnovsky series"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/chudnovsky-algorithm/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/chudnovsky-algorithm/",
      "json": "https://aiwiki.page/zh/chudnovsky-algorithm.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Chudnovsky algorithm is a method for computing π to high precision using a rapidly convergent infinite series discovered by the brothers David and Gregory Chudnovsky in 1988. Each additional term provides approximately 14.18 decimal digits of accuracy. Combined with binary splitting and fast large-integer arithmetic, it is one of the principal methods used for extremely large computations of π. The name can refer either to the underlying series identity or to an efficient computational procedure based on that identity."
    },
    {
      "heading": "The series",
      "text": "A standard form of the Chudnovsky identity is\n\n\\[\\frac{1}{\\pi} = 12\\sum_{k=0}^{\\infty} \\frac{(-1)^k(6k)!\\,(13591409+545140134k)} {(3k)!\\,(k!)^3\\,640320^{3k+3/2}}.\\]\n\nHere, \\(k!\\) denotes the factorial of the nonnegative integer \\(k\\). An equivalent form, more convenient for implementation, is\n\n\\[\\pi = \\frac{426880\\sqrt{10005}}{S},\\]\n\nwhere\n\n\\[S= \\sum_{k=0}^{\\infty} \\frac{(-1)^k(6k)!\\,(13591409+545140134k)} {(3k)!\\,(k!)^3\\,640320^{3k}}.\\]\n\nThe equivalence follows from\n\n\\[\\frac{640320^{3/2}}{12} = 426880\\sqrt{10005}.\\]\n\nAll terms of \\(S\\) are rational numbers. Consequently, a finite partial sum can be calculated exactly using integer arithmetic; approximation is needed only when evaluating the square root and performing the final division.\n\nKeeping only the term with \\(k=0\\) gives\n\n\\[\\pi\\approx \\frac{426880\\sqrt{10005}}{13591409},\\]\n\nwhich already agrees with π to roughly 14 decimal places."
    },
    {
      "heading": "Convergence and error",
      "text": "Write\n\n\\[A=13591409,\\qquad B=545140134,\\qquad C=640320,\\]\n\nand let\n\n\\[t_k= \\frac{(-1)^k(6k)!\\,(A+Bk)} {(3k)!\\,(k!)^3C^{3k}}.\\]\n\nThe ratio of consecutive terms is\n\n\\[\\frac{t_{k+1}}{t_k} = -\\frac{24(6k+1)(2k+1)(6k+5)} {C^3(k+1)^3} \\frac{A+B(k+1)}{A+Bk}.\\]\n\nAs \\(k\\) tends to infinity,\n\n\\[\\frac{t_{k+1}}{t_k} \\longrightarrow -\\frac{1728}{640320^3} = -\\frac{1}{53360^3}.\\]\n\nThus, apart from a slowly varying factor, the terms shrink like a geometric series with an exceptionally small ratio. The asymptotic number of decimal digits gained per term is\n\n\\[\\log_{10}(53360^3) = 3\\log_{10}(53360) \\approx 14.1816474627.\\]\n\nFor a target of \\(d\\) decimal digits, an initial estimate for the required number of terms is therefore\n\n\\[N\\approx\\frac{d}{14.1816474627}.\\]\n\nA practical implementation uses additional terms or guard digits and then checks an error bound rather than treating this estimate as a proof of accuracy.\n\nThe terms alternate in sign and decrease in magnitude. For\n\n\\[S_N=\\sum_{k=0}^{N-1}t_k,\\]\n\nthe alternating-series remainder satisfies\n\n\\[|S-S_N|\\leq |t_N|.\\]\n\nThis gives a bound on the series error. To certify digits of π, the bound must also be propagated through the reciprocal, and combined with errors from the square-root calculation and final arithmetic."
    },
    {
      "heading": "Mathematical origins",
      "text": "The Chudnovsky series belongs to the family of Ramanujan-type formulas for \\(1/\\pi\\). These connect rapidly convergent series with elliptic curves, modular functions, and special values associated with complex multiplication.\n\nThe number \\(640320\\) is not an arbitrary numerical choice. It is related to the special value\n\n\\[j\\!\\left(\\frac{1+\\sqrt{-163}}{2}\\right) = -640320^3,\\]\n\nwhere \\(j\\) is the modular invariant. The exceptional arithmetic properties associated with discriminant \\(-163\\) lead to the unusually rapid convergence.\n\nThe factorial expression also has a hypergeometric structure. For example,\n\n\\[F(z)= \\sum_{k=0}^{\\infty} \\frac{(6k)!}{(3k)!(k!)^3}z^k\\]\n\nis a hypergeometric series, and the linear factor in the Chudnovsky formula can be generated through\n\n\\[AF(z)+BzF'(z).\\]\n\nThe relevant argument is \\(z=-1/640320^3\\). Its small magnitude explains the speed of convergence at the level of the series, while modular-function identities establish the exact connection to \\(1/\\pi\\)."
    },
    {
      "heading": "Efficient evaluation",
      "text": "Recurrence-based summation\n\nDirectly evaluating the factorials and powers separately for every term repeats a large amount of work. Instead, the factorial coefficient can be updated through a recurrence relation.\n\nDefine\n\n\\[a_k= \\frac{(-1)^k(6k)!} {(3k)!(k!)^3C^{3k}}.\\]\n\nThen\n\n\\[a_0=1,\\]\n\nand\n\n\\[a_{k+1} = -a_k \\frac{24(6k+1)(2k+1)(6k+5)} {C^3(k+1)^3}.\\]\n\nThe series is simply\n\n\\[S=\\sum_{k=0}^{\\infty}a_k(A+Bk).\\]\n\nThis approach is straightforward and useful at moderate precision. At very high precision, repeatedly performing arithmetic at or near the full target precision becomes expensive.\n\nBinary splitting\n\nBinary splitting reorganizes the finite sum into a balanced tree of exact integer products and sums. It avoids repeated high-precision division and allows the largest operations to use efficient multiplication algorithms.\n\nOne standard construction sets\n\n\\[D=\\frac{640320^3}{24}.\\]\n\nFor a single index \\(k>0\\), define\n\n\\[P(k,k+1)=(6k-5)(2k-1)(6k-1),\\]\n\n\\[Q(k,k+1)=k^3D,\\]\n\n\\[T(k,k+1)=(-1)^kP(k,k+1)(A+Bk).\\]\n\nFor \\(k=0\\), use\n\n\\[P(0,1)=Q(0,1)=1, \\qquad T(0,1)=A.\\]\n\nTo combine adjacent intervals \\([a,m)\\) and \\([m,b)\\), compute\n\n\\[P(a,b)=P(a,m)P(m,b),\\]\n\n\\[Q(a,b)=Q(a,m)Q(m,b),\\]\n\n\\[T(a,b) = T(a,m)Q(m,b)+P(a,m)T(m,b).\\]\n\nAt the root of the tree,\n\n\\[S_N=\\frac{T(0,N)}{Q(0,N)},\\]\n\nso\n\n\\[\\pi\\approx \\frac{426880\\sqrt{10005}\\,Q(0,N)} {T(0,N)}.\\]\n\nAll \\(P\\), \\(Q\\), and \\(T\\) values are integers. The independent subtrees also provide opportunities for parallel computation."
    },
    {
      "heading": "Precision and computational cost",
      "text": "Ordinary fixed-size floating-point arithmetic cannot support arbitrarily many digits. Implementations instead use arbitrary-precision arithmetic or scaled integer arithmetic.\n\nA typical high-precision calculation involves:\n\n- Selecting a number of terms from the convergence estimate.\n- Evaluating the partial sum by binary splitting.\n- Computing \\(\\sqrt{10005}\\) to sufficient precision, often using Newton’s method or an integer square-root algorithm.\n- Performing the final multiplication and division.\n- Accounting for truncation and arithmetic errors before rounding the result.\n\nThe fast convergence does not make the total computation cost proportional merely to the number of terms. As precision increases, each large-integer operation becomes more expensive. Straightforward binary splitting can produce unreduced intermediate integers with \\(O(d\\log d)\\) bits for a \\(d\\)-digit target.\n\nWith fast multiplication, the algorithm has quasi-linear bit complexity: its running time is linear in the requested precision up to logarithmic factors. Precise bounds depend on the multiplication algorithm, management of common factors, and representation of intermediate values. Large implementations often use multiplication techniques based on the fast Fourier transform or related transforms.\n\nMemory management, parallel scheduling, storage bandwidth, and conversion from a binary representation to decimal output can also be significant costs. The time to evaluate the series alone is therefore not the complete cost of producing a very large decimal expansion."
    },
    {
      "heading": "Applications and limitations",
      "text": "The Chudnovsky algorithm is widely used in large-scale π computations because it combines rapid convergence with a structure well suited to exact arithmetic and binary splitting. Such calculations also serve as demanding tests of multiprecision software, processors, memory systems, and long-running computational infrastructure.\n\nIts main limitations concern scope and verification:\n\n- It computes an initial segment of π. It is not a digit-extraction method for directly obtaining a distant digit without calculating the preceding precision.\n- Fast convergence does not eliminate implementation errors. The series identity and its truncation bound do not by themselves verify a particular program, arithmetic library, or hardware run.\n- Correct rounding requires explicit error control. Guard digits are useful, but certified output requires bounds tight enough to establish the final rounded value.\n- Decimal digits do not establish general properties of π. A large computation cannot prove, for example, that π is a normal number, meaning that all finite digit strings occur with the expected limiting frequencies.\n\nOther high-precision methods include algorithms based on the arithmetic–geometric mean. Their iteration counts and convergence patterns differ from those of the Chudnovsky series, so practical comparisons must consider the full cost of arithmetic, memory use, and verification rather than the number of iterations alone."
    }
  ],
  "links": [
    "pi",
    "infinite-series",
    "factorial",
    "rational-number",
    "integer",
    "geometric-series",
    "elliptic-curve",
    "hypergeometric-function",
    "recurrence-relation",
    "parallel-computing",
    "floating-point-arithmetic",
    "newtons-method",
    "fast-fourier-transform"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}