ForHosting KIT · Math

Permutation with repetition

The letters of BANANA can be rearranged into 60 distinct words: 6 letters, with A three times and N twice. Enter the total and how often each identical item repeats, and get the exact number of different orderings. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
6
Repeats
3, 2, 1
You get
Quantity
60

Permutation with repetition, when you start from a total and the frequencies of identical items, counts how many distinct ordered arrangements a mixed collection can take. If you hold n objects and some of them are indistinguishable copies, the number of different sequences is n factorial divided by the product of the factorial of every listed repeat count. This calculator accepts that pair — the total n and the list of frequencies — evaluates the identity with exact BigInt arithmetic, and returns the permutation count as a decimal string. There is no sampling, no network call, and no clock-dependent rounding: every valid pair yields the same integer every time.

What a permutation with repetition of identical items counts

A permutation with repetition of identical items is the number of distinct ordered arrangements of a finite collection in which some members cannot be told apart. Write n for the total number of positions (or objects) and n1, n2, through nk for how many times each indistinguishable type appears. Because swapping two copies of the same type does not create a new arrangement, the n factorial orderings of a fully labeled collection over-count by n1 factorial for the first type, n2 factorial for the second, and so on.

The exact identity is therefore n factorial divided by the product of those factorials. Classic classroom checks include the letters of BANANA: six letters, three A's, two N's, and one B, which gives six factorial over three factorial times two factorial times one factorial, equal to sixty distinct words, and MISSISSIPPI: eleven letters with frequencies one, four, four, and two, which gives eleven factorial over those factorials, equal to thirty-four thousand six hundred fifty.

This is not the n-to-the-r product that some textbooks also call permutations with repetition: that other count fills r independent slots from an alphabet of n symbols and equals n raised to r. Here the length is already n, and the input is the frequency of each identical group. Frequencies that sum to less than n leave leftover unique items; each leftover contributes a one-factorial in the denominator and does not change the integer, so the same formula still applies.

The implementation never samples, never depends on the clock, and never rounds: it evaluates n factorial over the product of the listed factorials with exact BigInt arithmetic so large counts stay exact integers rather than overflowing a floating-point mantissa.

Anagrams, seating, and contest oracles

Language teachers and puzzle authors use this count when they ask how many distinct words can be formed by rearranging a given string: the letters are the items, the histogram of each letter is the list of repeat counts, and the answer is exactly n factorial over the product of those factorials. Chemistry and genetics problems that arrange beads, bases, or colored seats with indistinguishable copies follow the same integer.

Statistics instructors introduce it when they contrast sampling with identical outcomes against the n-to-the-r product that fills independent slots, and contest programmers need an exact oracle so they do not reimplement multiprecision factorial division in every language harness. Exam generators can pin the success path with n equals six and repeats equal to three, two, and one, which yields sixty, and the rejection path with any frequency larger than n, which must fail rather than return zero.

Sibling landings may target the n-to-the-r product of ordered selections with replacement, the generic multinomial coefficient, or permutations without repetition; this landing is specifically the wording permutation with repetition when the inputs are a total and the repeat counts of identical items. Pair the count with your own listing code if you need the actual distinct strings; this capability returns the integer count only.

Distinct anagrams of a word with repeated letters

Count how many distinct rearrangements a word such as BANANA or MISSISSIPPI has by sending the letter total n and the histogram of each repeated letter.

Homework and exam checks for n! / n1! n2! …

Let students submit a total and the repeat counts of identical items and verify their hand-computed permutation-with-repetition answer, including the hard reject when a frequency exceeds n.

Contest oracles and seating with identical seats

Pull an exact arrangement count when judging multiset-permutation problems or sizing seating plans that mix indistinguishable copies with leftover unique items.

What is a permutation with repetition of identical items?

It counts the distinct ordered arrangements of n items when some items are indistinguishable. If the repeat counts are n1, n2, … nk, the number is n! / (n1! × n2! × … × nk!).

What happens if a repeat count is larger than the total?

A group of identical items cannot occupy more positions than the collection contains, so every listed frequency must satisfy 0 ≤ ni ≤ n.

How is this different from n to the r permutations with repetition?

The n^r product fills r independent slots from an alphabet of n symbols (order matters, reuse allowed). This page instead takes a fixed total n and the frequencies of identical copies and returns n! / (n1! n2! … nk!).

Why is the permutation count a string?

Large n! / (n1! n2! …) values exceed JavaScript safe integers. A decimal string keeps every digit exact for every supported n and list of repeat counts.

What does the permutation-with-repetition calculator cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/permutation-with-repetition

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/permutation-with-repetition \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":6,"repeats":[3,2,1]}'
{
  "n": 6,
  "repeats": [
    3,
    2,
    1
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.permutation_with_repetition",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n10000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

When any listed frequency is larger than n the request fails with invalid_input, because a group cannot occupy more seats than the collection contains.

What a permutation with repetition of identical items counts

If a listed frequency is larger than n, the collection is impossible and this calculator rejects the request instead of returning zero or a signed extension.

How to send the total and the repeat counts

Field n is the total number of items — the numerator index of n factorial — and must be a whole number from zero through ten thousand. Field repeats is a non-empty array of non-negative integers, one entry per indistinguishable group, listing how many identical copies that group contributes. The sum of the frequencies must also stay at most n, otherwise the listed copies would overflow the collection. /(n1! n2! … nk!) so clients can display or log the rule without hard-coding it. POST a JSON body with two required fields. Aliases total and N are accepted for the same meaning. Aliases repeat_counts and frequencies map to the same array. Each frequency must be an integer from zero through n inclusive; if any entry is larger than n the task fails with invalid_input and a message that the repeat count exceeds the total. A successful response echoes n and the normalized repeats array, returns count as a decimal string of the exact permutation value, and includes formula as the identity n! Failed validation — a missing n or repeats, a non-integer, a fraction, a negative value, a value above the published maximum, an empty array, or any frequency that exceeds n — returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item. Use the endpoint from anagram checkers, programming-contest validators, interview-prep sandboxes, spreadsheet enrichment jobs, and discrete-math demos that need the distinct-arrangement count before any probability step. Prefer the string count over forcing a JavaScript Number so values larger than the safe-integer limit never lose low-order digits in JSON transport.

Anagrams, seating, and contest oracles

Keep n at most ten thousand so the worst-case factorial still finishes quickly on a Worker isolate and in the browser while covering teaching and contest sizes far beyond the safe Number range. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when students type an impossible frequency while learning the contract. Because the implementation is pure parse, every successful call costs the published $0.002 base price with no model tokens and no outbound network.

Read the full KIT documentation →