{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nThe *Chudnovsky algorithm* computes approximations of [[pi|0C1VYVNV2N]] from the Chudnovsky formula\n$$\\frac{1}{\\pi} = 12\\sum_{k=0}^{\\infty} \\frac{(-1)^k\\,(6k)!\\,(13591409 + 545140134\\,k)}{(3k)!\\,(k!)^3\\,640320^{3k + 3/2}},$$\nwhere $n!$ is the [[factorial|0XWG0JGDFW]].\nTo obtain $\\pi$ to $D$ decimal digits, it adds the first $N$ terms of this [[series|0AF7X08PCR]] and inverts the sum.\nHere $N$ is slightly more than $D/14$.\nThe partial sum is evaluated by binary splitting.\nThe rational numbers that form the terms are combined pairwise in a balanced tree, so the work is done with large-integer products.\n\n## Remarks\n\nThe ratio of successive terms tends to $-12^3/640320^3 \\approx -6.6 \\times 10^{-15}$, since $(6k)!/((3k)!(k!)^3)$ grows like a constant times $1728^k k^{-3/2}$ by Stirling's formula; this gives about $14.18$ digits per term.\nExample: the $k = 0$ term gives $\\pi \\approx 640320^{3/2}/(12\\cdot 13591409) = 3.14159265358973\\ldots$, correct to $13$ decimal places.\nNon-example: summing the Leibniz series $\\pi/4 = 1 - \\frac13 + \\frac15 - \\cdots$ is not this algorithm and is far slower: its error after $N$ terms is of order $1/N$.\nThe number $640320^3 = 262537412640768000$ is close to $e^{\\pi\\sqrt{163}} - 744$, which reflects the [[j-invariant|FEC2XH822R]] value $j\\big(\\frac{1 + \\sqrt{-163}}{2}\\big) = -640320^3$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "JKCKXDT5B5",
    "kind": "definition",
    "msc": [
      "11Y60",
      "65D20"
    ],
    "name": "Chudnovsky algorithm",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Chudnovsky_algorithm"
      }
    ],
    "tag": "Z5G5JPT022",
    "uses": [
      "0C1VYVNV2N",
      "0XWG0JGDFW",
      "0AF7X08PCR"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/Z5G5JPT022/",
  "links": [
    {
      "field": "defines",
      "target": "JKCKXDT5B5"
    },
    {
      "field": "uses",
      "target": "0C1VYVNV2N"
    },
    {
      "field": "uses",
      "target": "0XWG0JGDFW"
    },
    {
      "field": "uses",
      "target": "0AF7X08PCR"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/Z5G5JPT022.md",
  "msc": [
    "11Y60",
    "65D20"
  ],
  "name": "Chudnovsky algorithm",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/Z5G/Z5G5JPT022.md",
  "status": null,
  "tag": "Z5G5JPT022",
  "uri": "m2://Z5G5JPT022",
  "url": "https://tamnd.github.io/math2/wiki/chudnovsky-algorithm-definition/",
  "writing": {
    "tag": "Z5G5JPT022",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
