ForHosting KIT · Math

Permutations calculator

Count arrangements where order matters: 3 of 5 runners can take first, second and third place in 60 ways, P(5,3), because ABC and ACB are different finishes. 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
5
Resistance (Ω)
3
You get
Permutations
60
Notation
P(5,3)

Ordered arrangements matter whenever sequence changes the outcome: race finishing orders, password character positions, seating charts, playlist shuffles, and exam question sequences. The classical count is the permutation P of n items taken r at a time, equal to n factorial divided by n minus r factorial, often written nPr or P(n,r). This calculator evaluates that formula exactly with BigInt arithmetic so large intermediate products never lose digits to floating-point rounding.

What P(n,r) counts and when to use ordered arrangements

A permutation of r items chosen from n distinct items is any ordered sequence of length r with no repetition. Order matters: ABC and ACB are different arrangements of the same three letters. The closed formula is P(n,r) equals n factorial over n minus r factorial, which expands to the product of r consecutive integers starting at n and stepping down by one until n minus r plus one.

Classic classroom examples include choosing a president, vice-president, and secretary from a club of n members, lining up r runners from a field of n athletes, or assigning r distinct prizes when first place differs from second. When r equals n the count collapses to the full factorial n!, every item appears once in every ordering. When r equals zero the product is empty and the count is one by convention, matching the single empty sequence.

Combinations C(n,r) answer a different question: they ignore order and divide P(n,r) by r!, so if your problem treats two lineups as the same whenever they share the same members, you need combinations instead of permutations. Understanding that distinction early prevents the most common mistake in discrete-math homework and interview warm-ups. This tool focuses solely on the ordered count so searchers looking for an nPr calculator land on the formula they actually need.

Practical use, limits, pricing, and delivery

Use the browser tool when you want an immediate exact nPr while studying discrete math, checking a contest answer, or explaining ordered sampling without installing a computer-algebra system. Accepted indexes run from zero through ten thousand so classroom demos and combinatorial filters remain feasible without unbounded memory growth on pathological products. Results are fully deterministic: the same n and r always yield the same permutations value, notation, and formula fields.

There is no language model, no external arithmetic service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials.

Homework and contest verification

Students and graders confirm P(n,r) for ordered sampling problems without a local computer-algebra system, including edge cases P(n,0)=1 and P(n,n)=n!.

Sample-space sizing in probability scripts

Pipelines that model ordered draws without replacement can call a deterministic nPr oracle instead of reimplementing BigInt products in every language.

Teaching order-versus-combination

Lesson pages that contrast permutations with combinations can show exact P(n,r) beside the product definition so learners connect nPr notation to ordered arrangements.

What is the formula for nPr?

P(n,r) equals n factorial divided by (n−r) factorial, which is the product n×(n−1)×…×(n−r+1). Order matters and items are not repeated.

What happens if r is greater than n?

Permutations P(n,r) are undefined when r exceeds n; those calls are not charged.

Is the permutations calculator free?

The browser tool runs free on your device.

How do permutations differ from combinations?

Permutations count ordered arrangements (ABC ≠ ACB). Combinations C(n,r) count unordered subsets and equal P(n,r) divided by r!. This capacity returns only the ordered count P(n,r).

In how many ways can a club of 5 members choose a president, vice-president and secretary?

In 60 ways. Enter 5 as the total and 3 as the number of positions; each role is different, so the same three people in another order count as a new choice.

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/combo/permutations

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/combo/permutations \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":5,"r":3}'
{
  "n": 5,
  "r": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "combo.permutations",
  "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 r exceeds n the request fails with a clear validation error because permutations are undefined on that domain.

How this calculator computes nPr and validates input

The engine checks that both are present as finite non-negative integers at most the published upper bound of ten thousand. For accepted pairs the implementation multiplies BigInt factors from n down for exactly r steps, which is exactly n factorial over n minus r factorial without ever materializing two full factorials and dividing. The response also echoes n and r, a notation string such as P open five comma three close, and a formula string showing the factorial form. Edge cases are explicit: P of any n taken zero equals one, and P of n taken n equals n factorial. Send a JSON body with the required integer fields n and r. If r is greater than n the request fails immediately with invalid_input naming that domain rule, and the call is not charged. Missing fields, non-integers, negatives, and values above the limit also fail with invalid_input. The product is returned as a JSON number when it fits inside the safe integer range, otherwise as a decimal string so clients never lose high-order digits.

Practical use, limits, pricing, and delivery

Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into combinatorics demos, coding-interview sandboxes, probability tutorials that need sample-space sizes for ordered draws, or integer preprocessing steps where you already prefer exact permutation arithmetic over approximate heuristics or opaque black-box calculators that cannot show the product structure or the domain restriction when r exceeds n.

How do I compute permutations P(n,r) with this API?

Send a JSON body with integer fields n and r to combo.permutations. The response returns permutations, notation such as P(5,3), and the factorial formula.

Read the full KIT documentation →