{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Summary\n\nThe Fermat primality test is a probabilistic test of whether an integer $n \u003e 1$ is prime.\nIt chooses a base $a$ with $1 \u003c a \u003c n - 1$ and computes $a^{n-1} \\bmod n$ by [[modular exponentiation|04DR5PM25N]].\nIf the result is not $1$, then $n$ is composite, by [[Fermat's little theorem|0M25PRN3WQ]]. If the result is $1$, then $n$ is called a probable prime to the base $a$.\n\n## Remarks\n\nA probable prime can be composite. Such a number is a [[Fermat pseudoprime|02M2K4QH9P]].\nThe [[Carmichael numbers|0TA7WT68RK]] pass the test for each base coprime to them. So repeated tests with many bases cannot detect all composite numbers.\nThe [[Miller–Rabin primality test|0SZCSYHW60]] is a stronger test of the same kind, without this weakness.\n\n## Explanations\n\n### L1 human\n\nTo test $n = 15$ with $a = 2$, compute $2^{14} = 16384 \\equiv 4 \\pmod{15}$.\nThe result is not $1$, so $15$ is surely composite. The test does not find a factor; it only proves that one exists.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "kind": "concept",
    "msc": [
      "11Y11"
    ],
    "name": "Fermat primality test",
    "same_as": {
      "wikidata": "Q737492",
      "wikipedia": "Fermat primality test"
    },
    "sources": [
      {
        "locator": "Concept",
        "url": "https://en.wikipedia.org/wiki/Fermat_primality_test"
      }
    ],
    "tag": "0N5ZSZMYH6"
  },
  "kind": "concept",
  "link": "https://math2.tamnd.com/node/0N5ZSZMYH6/",
  "links": null,
  "markdown": "https://math2.tamnd.com/node/0N5ZSZMYH6.md",
  "msc": [
    "11Y11"
  ],
  "name": "Fermat primality test",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0N5/0N5ZSZMYH6.md",
  "status": null,
  "tag": "0N5ZSZMYH6",
  "uri": "m2://0N5ZSZMYH6",
  "url": "https://math2.tamnd.com/wiki/fermat-primality-test/",
  "writing": {
    "tag": "0N5ZSZMYH6",
    "kind": "concept",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
