{
  "category": "Statistical functions",
  "display_name": "PERMUTATIONA",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.PERMUTATIONA",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 4,
      "matched": 71911,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 71915,
      "unread": 0,
      "worst_ulp": 1
    },
    "detail": "Everything else matches (71,915 in the answer bank and 4 workbook cells). Last-bit means a finite number within 16 ULP of Excel's.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "close",
    "state_label": "Close: last-bit deviations remain",
    "summary": "Close: 4 of 71,919 recorded answers differ in the last bits, worst 1 ULP",
    "workbook_corpus": {
      "cells": 4,
      "matched": 4
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/math.rs#L131-L133",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/permutationa_fn.rs#L4-L32"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/math::binary",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric/x87::mul"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/math.rs#L131-L133",
      "state": "close",
      "suite": null,
      "summary": "Close: 4 of 71,919 recorded answers differ in the last bits, worst 1 ULP"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.PERMUTATIONA.json",
  "name": "PERMUTATIONA",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n- **[PERMUT](FUNC.PERMUT.md)** is the same count **without** repetition — the falling\n  factorial `n(n-1)…(n-k+1)` — and requires `k ≤ n`. The two agree at `k = 0` and `k = 1` and\n  diverge thereafter, with `PERMUTATIONA(n, k) ≥ PERMUT(n, k)` always.\n- **`COMBIN`** and **`COMBINA`** are the unordered counterparts, completing the standard\n  two-by-two grid: ordered/unordered against with/without replacement. `COMBINA(n, k)` counts\n  multisets and equals `COMBIN(n+k-1, k)`.\n- **`POWER`** and the `^` operator compute the same mathematical quantity for integer `n` and\n  `k`. This is not a decorative observation: `PERMUTATIONA(n, k)` and `POWER(n, k)` are two\n  Excel surfaces for `n^k`, and `EV-MATH-0008` names `POWER`, the `^` operator and\n  `PERMUTATIONA` together as subjects of the same finite-publication convention — while also\n  recording that `POWER` and `^` carry an *extra* rule the others do not, mapping an infinity\n  produced by a negative exponent over a sub-unit base to `#DIV/0!` instead of `#NUM!`.\n  Whether `PERMUTATIONA` and `POWER` return the same bits for the same integer inputs is not\n  established, and is a natural probe.\n- **`FACT`**, **`FACTDOUBLE`** and **`MULTINOMIAL`** are the neighbouring counting functions.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\nThe mathematics is a power of an integer, and the numerics is entirely about *how* that power\nis formed.\n\n1. **`pow` and repeated multiplication are different functions in floating point.** For\n   integer `k`, `exp(k · log n)` — what a general `pow` does internally, in one form or another\n   — accumulates the error of a logarithm and an exponential, amplified by `k`. Repeated\n   multiplication accumulates `k-1` roundings but never leaves the integers while the result is\n   below `2^53`. Binary exponentiation (square-and-multiply) is a third answer again: it uses\n   about `log₂ k` multiplications and rounds at different places. For results below `2^53` all\n   three agree, because the exact integer is representable; above it they generally do not.\n   An implementation that quietly delegates to the platform `pow` has chosen one of these and\n   should say so.\n2. **The exact regime is worth detecting.** `n^k < 2^53` covers most real spreadsheet uses, and\n   in that regime the correct answer is an exact integer that any careful staging reaches.\n   Getting the boundary right — and returning the exactly rounded value just past it — is more\n   valuable than shaving a multiply.\n3. **Overflow must be detected before it happens, not after.** Computing `n^k` and then testing\n   the result for infinity works on a platform with IEEE default rounding and no traps, but it\n   throws away the information needed to distinguish \"genuinely too large\" from \"intermediate\n   overflowed while the final result would have been fine\" — a distinction that matters for\n   `PERMUT` and does not arise here, since `n^k` is monotone in both arguments. The cheap\n   pre-test is `k · log₂ n > 1024`.\n4. **Underflow does not arise**: with `n ≥ 1` the result is at least 1, and `n = 0` is either\n   the empty-word corner or the documented error.\n\nThe Handbook does not assert what Excel does internally for this surface. `EV-MATH-0008` tells\nus where Excel places an error code, with named witnesses; it does not identify an op-graph,\nand it publishes no numeric comparison for this surface.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number`.\n\n- **`k = 0`** returns `1` for every admissible `n`, including `n = 0`. Microsoft's own remark\n  makes this explicit by scoping the error to the case where \"the total number is zero (0) and\n  the chosen number is larger than zero (0)\" — the corner is excluded, not the whole `n = 0`\n  column.\n- **`k > n` is ordinary**, not an error. This is the sharpest behavioural difference from\n  `PERMUT`, where `number < number_chosen` is a documented `#NUM!`.\n\n\n\n### Errors\n\n\nAs documented by Microsoft on the `PERMUTATIONA` page (retrieved for this page):\n\n| Error | Documented condition |\n|---|---|\n| `#NUM!` | The numeric arguments are not valid — the example given is `number = 0` with `number_chosen > 0` |\n| `#VALUE!` | An argument uses a nonnumeric data type |\n\nThe `#NUM!` row is documented by example rather than by a complete inequality, which is a real\ngap: the page states one invalid combination and says \"for example\". The negative-argument\ncases are therefore documented only by implication.\n\nError values arriving in either argument propagate under the ordinary coercion rules; see\n[Coercion and lifting](../model/02-coercion-and-lifting.md).\n\n\n\n### The suffix that means something else here\n\n\n`PERMUTATIONA` looks like it belongs to the `AVERAGEA` / `COUNTA` / `MAXA` / `MINA` /\n`STDEVA` / `VARA` group, where a trailing `A` marks a variant that **admits text and logical\nvalues** into a scan that the base function ignores. It does not. Here — and on `COMBINA` —\nthe `A` marks **repetition allowed**. Two unrelated naming conventions share one letter, and\nthis is the pair that catches people, because `PERMUTATIONA` is a statistical-category function\nsitting alphabetically beside genuine `A`-variants.\n\n",
    "sources": "\n- Microsoft, \"PERMUTATIONA function\" —\n  <https://support.microsoft.com/en-us/office/permutationa-function-6c7d7fdc-d657-44e6-aa19-2857b25cae4e>\n  (syntax, the `n^k` equation, the integer-truncation rule, the `#NUM!` example condition, the\n  `#VALUE!` condition, and version availability). Retrieved for this page.\n- Handbook evidence record `EV-MATH-0008` — the finite-publication convention (`XMD-008`),\n  which names `PERMUTATIONA` as a subject, carries named witnesses, and publishes no count.\n- Abramowitz & Stegun, *Handbook of Mathematical Functions*, chapter 24 — combinatorial\n  analysis.\n- Handbook, [Coercion and lifting](../model/02-coercion-and-lifting.md).\n- `data/functions/FUNC.PERMUTATIONA.json` — arity 2, `NumsToNum`, `UnaryNumericScalarOnly`\n  coercion profile, `real_result_policy … non_finite=num`, XLL symbol `xlfPermutationa`.\n- `data/presence/FUNC.PERMUTATIONA.json` — implementing module\n  `earlier-implementation/permutationa_fn.rs`, shared with no other surface.\n\n",
    "version-differences": "The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 19929 | Windows, bitness not recorded, CPU not recorded | 133 |\n| 20430 | Windows, 64-bit, CPU not recorded | 71,915 |\n\n- XC-PERMUTATIONA-001: build 19929 versus build 20430; 21 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.\n\nAgreement on these compared inputs does not establish agreement on unmeasured inputs.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.PERMUTATIONA.json).",
    "what-it-does": "\n`PERMUTATIONA(number, number_chosen)` counts the ordered arrangements of `number_chosen`\nobjects drawn from `number` objects **with repetition allowed**.\n\nWriting `n` for `number` and `k` for `number_chosen`, Microsoft states the equation directly:\n\n    PERMUTATIONA(n, k) = n^k\n\nThe derivation is the one-line one: each of the `k` positions is filled independently from all\n`n` objects, so the arrangements are the functions from a `k`-element set into an `n`-element\nset, and there are `n^k` of them. Combinatorially this is the size of `Sⁿ` raised to the\nsequence length — the count of words of length `k` over an alphabet of size `n`.\n\n**Domain and range.** After truncation to integers the documented domain is `n ≥ 0`, `k ≥ 0`,\nwith the single excluded corner `n = 0, k > 0` (there are no words of positive length over an\nempty alphabet). On that domain the value is a positive integer. Boundary identities:\n\n    PERMUTATIONA(n, 0) = 1        for every n ≥ 0, including n = 0\n    PERMUTATIONA(n, 1) = n\n    PERMUTATIONA(1, k) = 1\n    PERMUTATIONA(0, 0) = 1        the empty word; documented as admissible\n\nUnlike `PERMUT`, this function has **no upper constraint linking `k` to `n`**: `k` may exceed\n`n` freely, and does in the natural applications — how many four-digit PINs (`n = 10`,\n`k = 4`), how many length-`k` passwords over a character set.\n\nGrowth is exponential in `k`, so the representable range is narrow: the largest finite double\nis reached when `k log n` passes about `709.78` in natural logarithm, or equivalently when\n`n^k` exceeds roughly `1.798 × 10^308`. In practice the overflow boundary arrives at modest\ninputs, and how it is reported is a real part of this function's behaviour rather than an\nafterthought.\n\n\n\n### Arguments\n\n\n| Argument | Meaning | Default |\n|---|---|---|\n| `number` | The size of the pool the objects are drawn from. Required. | — |\n| `number_chosen` | The length of the arrangement. Required. | — |\n\nMicrosoft describes both as integers and states that **both arguments are truncated to\nintegers**. Truncation happens before validation, so `PERMUTATIONA(2.9, 3.9)` is the same call\nas `PERMUTATIONA(2, 3)`.\n\n"
  },
  "signature": {
    "display": "PERMUTATIONA(number, number_chosen)",
    "parameters": [
      {
        "description": null,
        "name": "number",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number_chosen",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "category": "Statistical functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "UnaryNumericScalarOnly",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "NumsToNum",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Number of ordered arrangements of k items from n when items may repeat: n to the power k",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects",
        "microsoft_url": "https://support.microsoft.com/en-us/office/permutationa-function-6c7d7fdc-d657-44e6-aa19-2857b25cae4e"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "bg-BG",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "cs-CZ",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "da-DK",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "de-DE",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "el-GR",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "en-AU",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "en-GB",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "en-US",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "es-ES",
          "name": "PERMUTACIONES.A"
        },
        {
          "locale": "et-EE",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "fi-FI",
          "name": "PERMUTAATIOA"
        },
        {
          "locale": "fr-FR",
          "name": "PERMUTATIONA*"
        },
        {
          "locale": "he-IL",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "hr-HR",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "hu-HU",
          "name": "VARIÁCIÓK.ISM"
        },
        {
          "locale": "id-ID",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "it-IT",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "ja-JP",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "ko-KR",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "lt-LT",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "lv-LV",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "nb-NO",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "nl-NL",
          "name": "PERMUTATIE.A"
        },
        {
          "locale": "pl-PL",
          "name": "PERMUTACJE.A"
        },
        {
          "locale": "pt-BR",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "pt-PT",
          "name": "PERMUTAR.R"
        },
        {
          "locale": "ro-RO",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "ru-RU",
          "name": "ПЕРЕСТА"
        },
        {
          "locale": "sk-SK",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "sl-SI",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "sv-SE",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "th-TH",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "tr-TR",
          "name": "PERMÜTASYONA"
        },
        {
          "locale": "uk-UA",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "vi-VN",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "zh-CN",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "zh-HK",
          "name": "PERMUTATIONA"
        },
        {
          "locale": "zh-TW",
          "name": "PERMUTATIONA"
        }
      ],
      "signature": {
        "display": "PERMUTATIONA(number, number_chosen)",
        "parameters": [
          {
            "description": null,
            "name": "number",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number_chosen",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "PERMUTATIONA",
      "version_marker": null,
      "xlcall": {
        "code": "567",
        "symbol": "xlfPermutationa"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/permutationa-function-6c7d7fdc-d657-44e6-aa19-2857b25cae4e"
  },
  "try_it": {
    "formula": "=PERMUTATIONA(2.9, 3.9)"
  },
  "url": "https://handbook.dnacalc.com/functions/PERMUTATIONA.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "133 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 19929",
      "platform": "Windows, bitness not recorded, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.PERMUTATIONA.json"
      ]
    },
    {
      "behaviour": "71,915 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.PERMUTATIONA.json"
      ]
    }
  ]
}