{
  "id": "permutation",
  "version": "e520b4bb840d",
  "status": "published",
  "name": "Permutation Calculator",
  "question": "How many permutations are there?",
  "summary": "Counts permutations exactly: nPr ordered arrangements of r items from n, arrangements with repetition (n^r), or the distinct arrangements of the letters of a word.",
  "category": "statistics",
  "subcategory": "probability",
  "url": "https://www.acalculator.org/statistics/permutation-calculator",
  "markdown": "https://www.acalculator.org/statistics/permutation-calculator.md",
  "kind": "function",
  "method": "nPr = n! ÷ (n − r)! = n (n − 1) … (n − r + 1); with repetition, n^r; letters of a word, n! ÷ (n₁! n₂! … nₖ!) where nⱼ counts each repeated letter.",
  "assumptions": [
    "n and r are whole numbers from 0 to 1,000. Without repetition, r is at most n.",
    "Letters: spaces are ignored and capital and small letters count as the same letter; any other character counts as a letter too.",
    "Counts are exact whole numbers; the scientific form is rounded half up to 6 significant digits."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "mode": {
        "title": "What are you arranging?",
        "description": "r of n different items, r picks where an item can repeat, or all the letters of a word.",
        "type": "string",
        "enum": [
          "npr",
          "repeat",
          "letters"
        ]
      },
      "n": {
        "title": "Items to choose from (n)",
        "description": "How many different items there are.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000
      },
      "r": {
        "title": "Items arranged (r)",
        "description": "How many positions are filled, in order.",
        "type": "integer",
        "minimum": 0,
        "maximum": 1000
      },
      "w": {
        "title": "Word or letters",
        "description": "The letters to arrange, such as MISSISSIPPI. Spaces are ignored; capital and small letters count as the same.",
        "type": "string",
        "maxLength": 200
      }
    }
  },
  "outputs": {
    "permutations": {
      "label": "Permutations",
      "description": "The number of different ordered arrangements.",
      "format": "integer"
    },
    "approx": {
      "label": "In scientific notation",
      "description": "The same count to 6 significant digits, shown when it has more than 15 digits.",
      "format": "text"
    },
    "formula": {
      "label": "Formula",
      "description": "The formula with your numbers.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "mode": "npr",
      "n": 10,
      "r": 3,
      "w": "DISTINCT"
    },
    "outputs": {
      "permutations": "720",
      "formula": "10! ÷ (10 − 3)! = 10! ÷ 7!"
    },
    "text": "There are 720 permutations (10! ÷ (10 − 3)! = 10! ÷ 7!)."
  },
  "examples": [
    {
      "given": {
        "mode": "npr",
        "n": 12,
        "r": 9
      },
      "expect": {
        "permutations": 79833600
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.5 Counting Principles, P(12, 9) = 79,833,600, https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles; Python 3: math.perm(12, 9)"
    },
    {
      "given": {
        "mode": "letters",
        "w": "DISTINCT"
      },
      "expect": {
        "permutations": 10080,
        "formula": "8! ÷ (2! for I, 2! for T)"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.5 Counting Principles, DISTINCT: 8! ÷ (2! 2!) = 10,080, https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles"
    },
    {
      "given": {
        "mode": "letters",
        "w": "Mississippi"
      },
      "expect": {
        "permutations": 34650
      },
      "source": "hand calculation in content.mdx: 11! ÷ (4! 4! 2!) = 34,650; NIST DLMF §26.4 Multinomial Coefficients, equation 26.4.2, https://dlmf.nist.gov/26.4"
    },
    {
      "given": {
        "mode": "repeat",
        "n": 10,
        "r": 4
      },
      "expect": {
        "permutations": 10000,
        "formula": "10^4"
      },
      "source": "hand calculation in content.mdx: 10 × 10 × 10 × 10 = 10,000 (multiplication principle); OpenStax, Algebra and Trigonometry 2e, §13.5, https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles"
    },
    {
      "given": {
        "mode": "npr",
        "n": 52,
        "r": 52
      },
      "expect": {
        "approx": "8.06582 × 10⁶⁷"
      },
      "source": "hand calculation in content.mdx: 52! ≈ 8.0658175 × 10⁶⁷; OpenStax, Algebra and Trigonometry 2e, §13.5, https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles; Python 3: math.factorial(52)"
    },
    {
      "given": {
        "mode": "npr",
        "n": 7,
        "r": 0
      },
      "expect": {
        "permutations": 1,
        "formula": "7! ÷ (7 − 0)! = 7! ÷ 7!"
      },
      "source": "OpenStax, Algebra and Trigonometry 2e, §13.5: P(n, 0) = n! ÷ n! = 1, https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles"
    }
  ],
  "sources": [
    "OpenStax, Algebra and Trigonometry 2e, §13.5 Counting Principles (P(n, r) = n! ÷ (n − r)!; permutations of non-distinct objects n! ÷ (r₁! r₂! … rₖ!); the multiplication principle). https://openstax.org/books/algebra-and-trigonometry-2e/pages/13-5-counting-principles (retrieved 2026-10-01)",
    "NIST Digital Library of Mathematical Functions, §26.4 Lattice Paths: Multinomial Coefficients, equation 26.4.2. https://dlmf.nist.gov/26.4 (retrieved 2026-10-01)"
  ],
  "related": [
    "combination",
    "probability",
    "dice-probability"
  ],
  "changelog": []
}
