{
  "aliases": [
    "cantor-pairing"
  ],
  "backlinks": [
    {
      "field": "uses",
      "target": "08G4XH86JC"
    }
  ],
  "body": "\n## Example\n\nThe Cantor pairing function is the function $\\pi \\colon \\mathbb{N} \\times \\mathbb{N} \\to \\mathbb{N}$ with\n$$\\pi(x, y) = \\frac{(x + y)(x + y + 1)}{2} + y.$$\nIt is a [[bijection|0SNQEF7Z53]].\nIt lists the pairs along the diagonals $x + y = 0, 1, 2, \\dots$: $\\pi(0, 0) = 0$, $\\pi(1, 0) = 1$, $\\pi(0, 1) = 2$, $\\pi(2, 0) = 3$.\n\n## Remarks\n\nSo $\\mathbb{N} \\times \\mathbb{N}$ is [[countably infinite|0SEZ3JGZP7]]. See [[product of countable sets is countable|08G4XH86JC]].\nThe value $(x + y)(x + y + 1)/2$ is the number of pairs on the earlier diagonals, and $y$ is the position on the diagonal.\n\n## Explanations\n\n### L1 human\n\nWrite the pairs $(x, y)$ in an infinite grid.\nWalk through the grid along the short diagonals, one after the other, and number the pairs as you go.\nEach pair gets exactly one number, and each number gets exactly one pair.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "aliases": [
      "cantor-pairing"
    ],
    "instance_of": [
      "0GG9TVW90M"
    ],
    "kind": "example",
    "msc": [
      "03E10"
    ],
    "name": "Cantor pairing function",
    "same_as": {
      "wikidata": "Q1033906",
      "wikipedia": "Pairing function"
    },
    "sources": [
      {
        "locator": "Cantor pairing function",
        "url": "https://en.wikipedia.org/wiki/Pairing_function"
      }
    ],
    "tag": "0NP5N5PYW5",
    "uses": [
      "0SNQEF7Z53",
      "0C81YBVTWH"
    ]
  },
  "kind": "example",
  "link": "https://math2.tamnd.com/node/0NP5N5PYW5/",
  "links": [
    {
      "field": "instance_of",
      "target": "0GG9TVW90M"
    },
    {
      "field": "uses",
      "target": "0SNQEF7Z53"
    },
    {
      "field": "uses",
      "target": "0C81YBVTWH"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0NP5N5PYW5.md",
  "msc": [
    "03E10"
  ],
  "name": "Cantor pairing function",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0NP/0NP5N5PYW5.md",
  "status": null,
  "tag": "0NP5N5PYW5",
  "uri": "m2://0NP5N5PYW5",
  "url": "https://math2.tamnd.com/wiki/cantor-pairing-function/",
  "writing": {
    "tag": "0NP5N5PYW5",
    "kind": "example",
    "level": "W2",
    "next": [
      {
        "what": "a person confirmed each agent-written section",
        "note": "rule P04",
        "have": 0,
        "want": 1
      }
    ]
  }
}
