{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Summary\n\nTrial division is the simplest method to factor an integer $n \u003e 1$ or to test whether it is prime.\nIt divides $n$ by the integers $d = 2, 3, 4, \\dots$ in turn, and it stops at the first $d$ that divides $n$, or when $d^2 \u003e n$.\nIf no $d$ with $d^2 \\le n$ divides $n$, then $n$ is prime.\n\n## Remarks\n\nThe method is correct because [[a composite number has a prime factor at most its square root|0EB6BBMQMC]].\nIt is enough to test the primes $d$, but a test of all integers $d$ is also correct.\nFor a number $n$ with $k$ digits, the method can need about $\\sqrt{n} \\approx 10^{k/2}$ divisions. Thus it is slow for large $n$.\n\n## Explanations\n\n### L1 human\n\nTo test whether $91$ is prime, try to divide it by $2$, $3$, $5$ and $7$. You can stop after $9$, because $10^2 \u003e 91$.\nThe division by $7$ works: $91 = 7 \\cdot 13$. So $91$ is not prime.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "kind": "concept",
    "msc": [
      "11Y05"
    ],
    "name": "Trial division",
    "same_as": {
      "wikidata": "Q1333681",
      "wikipedia": "Trial division"
    },
    "sources": [
      {
        "locator": "Method",
        "url": "https://en.wikipedia.org/wiki/Trial_division"
      }
    ],
    "tag": "0Z962ECCXR"
  },
  "kind": "concept",
  "link": "https://math2.tamnd.com/node/0Z962ECCXR/",
  "links": null,
  "markdown": "https://math2.tamnd.com/node/0Z962ECCXR.md",
  "msc": [
    "11Y05"
  ],
  "name": "Trial division",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0Z9/0Z962ECCXR.md",
  "status": null,
  "tag": "0Z962ECCXR",
  "uri": "m2://0Z962ECCXR",
  "url": "https://math2.tamnd.com/wiki/trial-division/",
  "writing": {
    "tag": "0Z962ECCXR",
    "kind": "concept",
    "level": "W1",
    "next": [
      {
        "what": "edge defines in",
        "note": "at least one definition",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge instance_of in",
        "note": "at least two examples",
        "have": 0,
        "want": 2
      },
      {
        "what": "edge not_instance_of in",
        "note": "at least one non-example",
        "have": 0,
        "want": 1
      },
      {
        "what": "edge specializes both",
        "note": "the more general notions and the special cases",
        "have": 0,
        "want": 1
      }
    ]
  }
}
