{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Summary\n\nThe sieve of Eratosthenes is an algorithm that finds all the [[prime numbers|0SN0MAEKYX]] up to a given bound $N$.\nIt writes the integers from $2$ to $N$. It takes the smallest number that is not crossed out, which is a prime $p$, and crosses out the multiples $p^2, p^2 + p, p^2 + 2p, \\dots$ up to $N$.\nIt repeats this step while $p^2 \\le N$. The numbers that are not crossed out at the end are the primes up to $N$.\n\n## Remarks\n\nIt is enough to start at $p^2$, because a smaller multiple of $p$ has a smaller prime factor, and an earlier step crossed it out.\nThe algorithm needs about $N \\log \\log N$ operations.\nThe idea of the sieve is the basis of sieve methods in analytic number theory.\n\n## Explanations\n\n### L1 human\n\nFor $N = 30$, cross out the multiples of $2$ from $4$, then the multiples of $3$ from $9$, then the multiples of $5$ from $25$.\nThen $7^2 = 49 \u003e 30$, so you stop.\nThe numbers left are $2, 3, 5, 7, 11, 13, 17, 19, 23, 29$.\n",
  "commit": "f591989ed15704e9d8755a7a5a6426d73de7a3ae",
  "front": {
    "kind": "concept",
    "msc": [
      "11Y11"
    ],
    "name": "Sieve of Eratosthenes",
    "same_as": {
      "wikidata": "Q177898",
      "wikipedia": "Sieve of Eratosthenes"
    },
    "sources": [
      {
        "locator": "Overview",
        "url": "https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes"
      }
    ],
    "tag": "0XM8ZA9RNM"
  },
  "kind": "concept",
  "link": "https://math2.tamnd.com/node/0XM8ZA9RNM/",
  "links": null,
  "markdown": "https://math2.tamnd.com/node/0XM8ZA9RNM.md",
  "msc": [
    "11Y11"
  ],
  "name": "Sieve of Eratosthenes",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0XM/0XM8ZA9RNM.md",
  "status": null,
  "tag": "0XM8ZA9RNM",
  "uri": "m2://0XM8ZA9RNM",
  "url": "https://math2.tamnd.com/wiki/sieve-of-eratosthenes/",
  "writing": {
    "tag": "0XM8ZA9RNM",
    "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
      }
    ]
  }
}
