Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Permutations and Combinations with Repetition Calculator

Choose what to count, then enter the number of kinds n and the number of items r (or a word, for rearranging letters). The formula below is linked to the input fields, so you can also edit the numbers directly in it.

Enter n and r as whole numbers (n from 1 to 1000, r from 0 to 1000). Every digit of the answer is shown exactly, even with dozens of digits. For rearranging letters, you can enter up to 30 characters. Spaces are ignored, and capital and small letters count as different letters.
Result and figure
Choose what to count in the fields on the left, enter the number of kinds and items (or a word), and press "Calculate". The result and a figure will appear here.

What you can do on this page

  • Find the permutations with repetition \({}_{n}\Pi_{r} = n^{r}\), arranging \(r\) items from \(n\) kinds when the same kind can be used any number of times (example - a 4-digit PIN made from the 10 digits 0 to 9)
  • Find the combinations with repetition \({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\), choosing \(r\) items when the same kind can be chosen any number of times (example - buying 5 bottles from 3 kinds of juice)
  • Just type in a word such as "TOMATO" to count the ways to rearrange letters that include repeats (distinguishable permutations, up to 30 letters)
  • Not sure whether to use \(n^{r}\), \({}_{n}\mathrm{H}_{r}\), \({}_{n}\mathrm{P}_{r}\) or \({}_{n}\mathrm{C}_{r}\)? A decision chart based on "Does order matter?" and "Can the same item be chosen again?" is included
  • Answers are shown with every digit, no rounding, even with dozens of digits. For long answers, an approximate value such as \(1.2345 \times 10^{18}\) is added
  • Diagrams of combinations with repetition using circles and bars (stars and bars), and copy-and-paste formulas for Excel, Google Sheets and Python, are also on this page
If you only need the permutations \({}_{n}\mathrm{P}_{r}\) or combinations \({}_{n}\mathrm{C}_{r}\) without repetition (an item cannot be chosen again once it is picked), see the Permutation and Combination Calculator page.

What is this calculation used for?

Putting a number on how hard a PIN or password is to crack (security)

A 4-digit PIN made from the 10 digits 0 to 9, where the same digit can be used any number of times, has \(10^{4} = 10{,}000\) possibilities. Each extra digit multiplies that by 10, so 6 digits give 1 million.
A password that can use 62 kinds of characters (capital letters, small letters and digits) has \(62^{8} = 218{,}340{,}105{,}584{,}896\) possibilities with 8 characters (about 218 trillion). The permutations with repetition formula lets you compare how much "more kinds of characters" and "a longer password" each help.

How much digital data can express (computers)

Computers represent information with just 2 kinds of symbols, 0 and 1. A byte, a row of 8 of them, can show \(2^{8} = 256\) patterns. That is why a byte is said to have 256 levels.
Full color, with 8 bits each for red, green and blue, gives \(2^{24} = 16{,}777{,}216\) colors, about 16.7 million. The number of screen colors, the bit depth of audio, the number of IP addresses and so on, the "how many can it represent" of every digital device, comes down to permutations with repetition.

Why the genetic code uses 3 letters at a time (life science)

DNA is made of 4 kinds of bases, A, T, G and C, and each group of 3 in a row (a codon) stands for 1 amino acid used to build the body. The same base can repeat, so there are \(4^{3} = 64\) kinds of codons.
The body uses 20 kinds of amino acids, and groups of 2 would give only \(4^{2} = 16\), which is not enough. Permutations with repetition confirm why groups of 3 are enough for life to work.

Counting assortments and orders (retail and food service)

Making a box of a dozen donuts from 5 kinds, with any number of each kind allowed, can be done in \({}_{5}\mathrm{H}_{12} = {}_{16}\mathrm{C}_{12} = 1{,}820\) ways, since order does not matter (combinations with repetition).
Counting orders or inventory breakdowns of "how many of which product" is the same kind of calculation. You can estimate with real numbers, not just a feeling, how many more patterns you need to manage when you add one more product.

Counting shortest paths (logistics and circuit design)

On a grid of city blocks, the number of shortest paths that go 3 blocks right and 2 blocks up is the same as the number of rearrangements of the 5 letters "R, R, R, U, U", so it is \(\dfrac{5!}{3!\,2!} = 10\). Distinguishable permutations work directly here.
This calculation is the basis for estimating the number of possible delivery routes or wiring patterns on a circuit board, and it shows in numbers how explosively the options grow as the grid gets larger.

Formulas and figures

Permutations with repetition \({}_{n}\Pi_{r}\) (arranging \(r\) items, repeats allowed)
Figure
Standard notation (the usual math form)
\({}_{n}\Pi_{r}\) \(=\) \(n\) \(r\)
In words (symbols replaced with words)
③ \({}_{n}\Pi_{r}\): ways to arrange \(r\) items with repeats allowed \(=\) ① \(n\): number of kinds for each place ② \(r\): number of items to arrange
The formula in words
① Multiply the \(n\): number of kinds for each place by itself
② as many times as the \(r\): number of items to arrange
③ and you get the \({}_{n}\Pi_{r}\): ways to arrange \(r\) items with repeats allowed
Quick example
The number of ways to make a 4-digit PIN from the 10 digits 0 to 9 is
ways to make a 4-digit PIN \(=\) digits for each place (10) number of digits (4)
\({}_{10}\Pi_{4} = 10^{4} = 10 \times 10 \times 10 \times 10 = 10000\)
Key idea
Since the same item can be chosen any number of times, the number of choices stays at \(n\) for the second place, the third place and so on. It never goes down. So you multiply by \(n\) every time, and multiplying \(n\) by itself \(r\) times gives \(n^{r}\). This is the only difference from the permutations \({}_{n}\mathrm{P}_{r} = n \times (n-1) \times \cdots\), where the choices go down by 1 each time you pick. Ask yourself "Does the supply run out or not?" and you can tell them apart. The \(\Pi\) in \({}_{n}\Pi_{r}\) is the capital Greek letter pi, which stands for a product (multiplication). It matches the P in "product". However, this symbol is not used nearly as widely as \({}_{n}\mathrm{P}_{r}\) and \({}_{n}\mathrm{C}_{r}\). Most US textbooks simply say that the number of permutations with repetition is \(n^{r}\). On homework and tests, writing \(n^{r}\) is always understood.
Combinations with repetition \({}_{n}\mathrm{H}_{r}\) (choosing \(r\) items, repeats allowed)
Figure
Standard notation (the usual math form)
\({}_{n}\mathrm{H}_{r}\) \(=\) \(n+r-1\) \(\mathrm{C}\) \(r\)
In words (symbols replaced with words)
③ ways to choose \(r\) items with repeats allowed \(=\) ① \(n+r-1\): places for circles and bars \(\mathrm{C}\) ② \(r\): places that get a circle
The formula in words
① Line up \(r\) circles and \(n-1\) bars that mark the boundaries between kinds. Out of the \(n+r-1\): places for circles and bars in all ,
② count the ways to pick the \(r\): places that get a circle
③ and you get the \({}_{n}\mathrm{H}_{r}\): ways to choose \(r\) items with repeats allowed
Quick example
The number of ways to buy 5 bottles from 3 kinds of juice (apple, orange and grape), with any number of each kind allowed, is
ways to buy 5 from 3 kinds \(=\) places (3 + 5 − 1 = 7) \(\mathrm{C}\) places for circles (5)
\({}_{3}\mathrm{H}_{5} = {}_{3+5-1}\mathrm{C}_{5} = {}_{7}\mathrm{C}_{5} = \dfrac{7 \times 6}{2 \times 1} = 21\)
Key idea
We were only choosing, so why does it turn into the combination \({}_{n+r-1}\mathrm{C}_{r}\)? The secret is rewriting the choice as circles and bars (a method known as "stars and bars"). Before memorizing it as a formula, follow the steps below. First, fix the order of the kinds: apple, orange, grape. Then write each bottle you buy as a circle ○ and each boundary between kinds as a bar |. Buying 2 apple, 1 orange and 2 grape becomes ○○|○|○○. Buying 3 apple, 0 orange and 2 grape becomes ○○○||○○. A kind you buy none of just shows up as two bars next to each other, so it can be written too. Going the other way, if you are shown a row of circles and bars first, you can read exactly one way of buying from it. Look at the 3 spaces separated by the bars, from left to right. The number of circles in each space is the number of apple, orange and grape bottles. ○○||○○○ means 2 apple, 0 orange and 3 grape. From a purchase to a row of symbols, and from a row of symbols back to a purchase, there is always exactly one answer. So purchases and rows of symbols match up one to one, with nothing missed and nothing counted twice. Now all you need to do is count the rows of symbols. The bars separate 3 kinds, so there are 2 of them (\(n-1\) in general), and there are \(r\) circles, one for each bottle. That makes \(n+r-1\) symbols in all, in places numbered 1, 2, … from the left. Choosing one row is the same as choosing which \(r\) of the \(n+r-1\) numbered places get a circle. At this point it is just an ordinary combination, where the same place cannot be chosen twice. That is why \({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\). You can also choose the places for the bars instead of the circles. The remaining places automatically get circles, so it comes to the same thing. Writing \({}_{n+r-1}\mathrm{C}_{n-1}\) gives the same answer. The \(\mathrm{H}\) is said to come from "homogeneous", as in the collection of all terms of the same degree. The symbol \({}_{n}\mathrm{H}_{r}\) is rarely used in US textbooks. There, you simply write the answer as \({}_{n+r-1}\mathrm{C}_{r}\) or \(\binom{n+r-1}{r}\), using stars and bars as above.
Distinguishable permutations (rearranging items that include identical ones)
Figure
Standard notation (the usual math form)
\(N\) \(=\) \(n!\) \(\div\) \(p!\,q!\,r!\cdots\)
In words (symbols replaced with words)
③ \(N\): ways to arrange \(n\) items that include identical ones \(=\) ① \(n!\): arrangements if every item were different \(\div\) ② \(p! \times q! \times \cdots\): ways to reorder identical items among themselves
The formula in words
① Take the \(n!\): arrangements if every item were different
② divide it by the \(p! \times q! \times \cdots\): ways to reorder identical items among themselves to remove the repeats
③ and you get the \(N\): ways to arrange \(n\) items that include identical ones
Quick example
The number of strings you can make by rearranging the 6 letters of "TOMATO" (two Ts, two Os, one M and one A) is
rearrangements of TOMATO \(=\) 6 letters all different (6!) \(\div\) reorderings of identical letters (2! × 2! × 1! × 1!)
\(N = \dfrac{6!}{2!\,2!\,1!\,1!} = \dfrac{720}{2 \times 2 \times 1 \times 1} = \dfrac{720}{4} = 180\)
Key idea
Give the two Ts temporary labels, \(\mathrm{T}_1\) and \(\mathrm{T}_2\), and all 6 letters become different, so there are \(6! = 720\) arrangements. But once you erase the labels, \(\mathrm{T}_1\mathrm{T}_2\) and \(\mathrm{T}_2\mathrm{T}_1\) look exactly the same, so each arrangement has been counted twice. If a letter appears \(p\) times, all \(p!\) ways to reorder those \(p\) copies look the same, so you divide by \(p!\) for each kind of letter. A letter that appears only once gives \(1! = 1\), so writing it or not does not change the answer. Be careful about what the letters mean here. Unlike the \(n\) in the two formulas above (the number of kinds you choose from), the \(n\) in this formula is the total number of items to arrange. "TOMATO" has 4 kinds of letters, T, O, M and A, but you arrange 6 letters, so \(n = 6\). The \(p,\ q,\ r,\ \dots\) in the denominator are the counts for each kind, so they always add up to \(p + q + r + \cdots = n\). For TOMATO, \(2 + 2 + 1 + 1 = 6\), which matches the number of letters. If this sum does not match, it is a sign that you missed something or counted something twice. (The \(r\) here is just the third letter used for a count. It is not the "number of items \(r\)" from the formulas above.) \(\dfrac{n!}{p!\,q!\cdots}\) is also called a multinomial coefficient. Along with combinations with repetition, it is a classic way to count arrangements that include identical items. The number of shortest paths on a grid of city blocks that go 3 blocks right and 2 blocks up, \(\dfrac{5!}{3!\,2!} = 10\), is another use of this formula.
Which formula should you use? (arrange or just choose × repeats allowed or not)
Figure
Standard notation (the usual math form)
\({}_{n}\Pi_{r} = n^{r}\)
\({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\)
\({}_{n}\mathrm{P}_{r} = \dfrac{n!}{(n-r)!}\)
\({}_{n}\mathrm{C}_{r} = \dfrac{n!}{r!\,(n-r)!}\)
In words (symbols replaced with words)
① arrange × the same item can be chosen any number of times
② just choose × the same item can be chosen any number of times
③ arrange × an item cannot be chosen again once it is picked
④ just choose × an item cannot be chosen again once it is picked
The formula in words
① If order matters (role, rank or digit place) and the same item can be chosen any number of times, use the permutations with repetition \({}_{n}\Pi_{r} = n^{r}\)
② If only the selection matters and the same item can be chosen any number of times, use the combinations with repetition \({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\)
③ If order matters and an item cannot be chosen again once it is picked, use the permutations \({}_{n}\mathrm{P}_{r}\)
④ If only the selection matters and an item cannot be chosen again once it is picked, use the combinations \({}_{n}\mathrm{C}_{r}\)
Quick example
Even with the same numbers 4 and 3, the formula changes with the situation
ways to buy 3 scoops from 4 ice cream flavors (any flavor can repeat) \(=\) combinations with repetition
ways to pick 1st, 2nd and 3rd place from 4 people \(=\) permutations
\({}_{4}\mathrm{H}_{3} = {}_{6}\mathrm{C}_{3} = 20\)
\({}_{4}\mathrm{P}_{3} = 4 \times 3 \times 2 = 24\)
Key idea
Before you get to these 4, there is one fork in the road. Is it a situation where you choose \(r\) items from \(n\) kinds? Or is it one where the items are already in front of you and you arrange all of them, like the 6 letters of TOMATO? In the second case there is no choosing, so instead of the 4 formulas above, use distinguishable permutations \(\dfrac{n!}{p!\,q!\cdots}\). First, tell apart "choose, then arrange" and "arrange everything you have". Once you know it is a choosing situation, check these 2 questions in this order. (1) Are you arranging, or only counting the selection? (2) Can the same item be chosen two or more times, or is it done once it is picked? The clue for (1) is whether each place has its own meaning. If the places have roles, such as 1st and 2nd place, captain and vice captain, or the 1st and 2nd digits of a PIN, you are arranging. If only the group matters, such as 2 people on cleanup duty or what is in a shopping basket, you are just choosing. The clue for (2) is whether the supply runs out. If choosing does not use anything up, as when you roll a die again and again, buy any number of the same flavor, or reuse the same digit, repeats are allowed. If it does, as when one person cannot hold 2 roles or the same ticket cannot be drawn twice, there are no repeats. The gap between \(n^{r}\) and \({}_{n}\mathrm{P}_{r}\) widens as \(r\) grows (choosing 4 from 10 kinds gives \(10^{4} = 10000\) versus \({}_{10}\mathrm{P}_{4} = 5040\)). Mixing up (2) can nearly double the answer, so do not skip this check.
To arrange with repeats allowed, use the permutations with repetition \({}_{n}\Pi_{r} = n^{r}\). To just choose with repeats allowed, use the combinations with repetition \({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\). To arrange everything you have when some items are identical, use \(\dfrac{n!}{p!\,q!\cdots}\). The key idea of this topic is that rewriting a combination with repetition as circles and bars (stars and bars) turns it into an ordinary combination \({}_{n+r-1}\mathrm{C}_{r}\).

Symbols and terms

Symbols

\(n\) en The number of kinds you choose from. (Example - choosing from 3 kinds of juice, \(n = 3\); using the digits 0 to 9, \(n = 10\).) The letter \(n\), for "number", is often used for counts. Only in distinguishable permutations \(\dfrac{n!}{p!\,q!\cdots}\) does it mean something else: the total number of items to arrange ("TOMATO" has 4 kinds of letters, but \(n = 6\)).
\(r\) ar The number of items you choose (or arrange) with repeats allowed. (Example - buying 5 bottles of juice, \(r = 5\); a 4-digit PIN, \(r = 4\).) It sits in the same position as in the permutation and combination symbols \({}_{n}\mathrm{P}_{r}\) and \({}_{n}\mathrm{C}_{r}\).
\(n!\) n factorial The product of all the whole numbers from \(n\) down to \(1\). It is the number of ways to arrange all \(n\) items in a row. By definition, \(0! = 1\). (Example - \(4! = 4 \times 3 \times 2 \times 1 = 24\))
\({}_{n}\Pi_{r}\) n pi r Permutations with repetition: the number of ways to choose \(r\) items from \(n\) kinds with repeats allowed and arrange them in order. Its value is \(n^{r}\). \(\Pi\) is the capital Greek letter pi, which stands for a product and matches the P in "product". Most US textbooks just write \(n^{r}\) without this symbol, so follow the notation used in your class.
\({}_{n}\mathrm{H}_{r}\) n H r Combinations with repetition: the number of ways to choose \(r\) items from \(n\) kinds with repeats allowed, where order does not matter. Its value is \({}_{n+r-1}\mathrm{C}_{r}\). The \(\mathrm{H}\) is said to come from "homogeneous", as in the collection of all terms of the same degree. This symbol is rarely seen in US textbooks, which write \(\binom{n+r-1}{r}\) instead.
\({}_{n}\mathrm{P}_{r}\) n P r Permutations: the number of ways to choose \(r\) of \(n\) items and put them in order, where an item cannot be chosen again once it is picked. P stands for "permutation".
\({}_{n}\mathrm{C}_{r}\) n C r Combinations: the number of ways to choose \(r\) of \(n\) items, where an item cannot be chosen again once it is picked and order does not matter. C stands for "combination".
\(N\) capital N On this page, the letter for the number of distinguishable permutations. It is the capital first letter of "number" and is often used for a total you want to find.
\(p,\ q\) p, q In distinguishable permutations, the letters for how many copies of each identical item there are. (Example - in "TOMATO", T appears \(p = 2\) times, O \(q = 2\) times, M once and A once.) With 3 or more kinds, continue with \(p,\ q,\ r,\ \dots\) (this \(r\) is not the "number of items \(r\)"). They always add up to \(p + q + r + \cdots = n\), the total number of items to arrange.
\(\bigcirc\) and \(|\) circle and bar The symbols used to count combinations with repetition (a method known as "stars and bars"). A circle ○ is one item chosen, and a bar \(|\) is a boundary between kinds. ○○|○|○○ means 2 of the first kind, 1 of the second and 2 of the third.

Terms

counting Finding how many possible outcomes there are in total. Permutations, combinations and their versions with repetition are all tools for counting efficiently.
repetition The same item appearing two or more times. In this topic, it means that the same item may be chosen two or more times. It is also described as choosing "with replacement".
permutation with repetition An arrangement of \(r\) items chosen from \(n\) kinds, where the same kind can be chosen any number of times and order matters. There are \(n^{r}\) of them, written \({}_{n}\Pi_{r}\) as a symbol.
combination with repetition A selection of \(r\) items from \(n\) kinds, where the same kind can be chosen any number of times and order does not matter. There are \({}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r}\) of them.
distinguishable permutation An arrangement of all \(n\) items when some of them are identical, as in "TOMATO". There are \(\dfrac{n!}{p!\,q!\cdots}\) of them: you divide by the reorderings of identical items to remove the repeats. Also called a permutation with identical items.
permutation A way to choose \(r\) of \(n\) items and put them in a row, where order matters. The symbol is \({}_{n}\mathrm{P}_{r}\), and an item cannot be chosen again once it is picked.
combination A way to choose \(r\) of \(n\) items where order does not matter. The symbol is \({}_{n}\mathrm{C}_{r}\), and an item cannot be chosen again once it is picked.
factorial Multiplying all the whole numbers from \(n\) down to \(1\). The symbol is \(n!\), and it gives the number of ways to arrange all \(n\) items.
stars and bars The method of counting combinations with repetition with symbols: a bar \(|\) marks each boundary between kinds, and a star (a circle ○ on this page) marks each item. Separating \(n\) kinds takes \(n-1\) bars, so the problem becomes choosing the places for the circles out of \(n+r-1\) places.
multinomial coefficient Another name for the number of distinguishable permutations, \(\dfrac{n!}{p!\,q!\cdots}\). The name comes from the fact that the coefficients you get when you expand \((a+b+c)^{n}\) have this form.
tree diagram A branching diagram that lists every possible outcome, so you count each one exactly once. Permutations with repetition correspond to a tree where every branch splits into the same number of branches.
shortest path On a grid of streets, a route to the destination with no detours. The number of shortest paths that go \(p\) blocks right and \(q\) blocks up is the distinguishable permutations \(\dfrac{(p+q)!}{p!\,q!}\).

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over the topics in this table is the fastest way forward.

Multiplication and division (Grades 3–5)
  • Being able to multiply the same number several times, as in \(10 \times 10 \times 10 \times 10\)
  • Being able to divide, as in \(720 \div 4 = 180\)
Powers and exponents (Grades 6–8, Algebra 1)
  • Knowing that the small number at the upper right (the exponent) tells how many times to multiply, as in \(3^{4} = 3 \times 3 \times 3 \times 3 = 81\)
  • Seeing that raising the exponent by 1 multiplies the answer by the base (\(10^{5}\) is 10 times \(10^{4}\))
Counting outcomes and tree diagrams (Grade 7)
  • Being able to list all possible outcomes with a tree diagram or similar, counting each one exactly once
  • Seeing that arranging (order matters) and choosing (order does not matter) are two different ways of counting
Factorials (high school, Algebra 2 or Precalculus)
  • Knowing that \(n!\) means "multiply everything from \(n\) down to \(1\)"
  • Knowing the rule that \(0! = 1\)
Permutations and combinations (high school, Algebra 2 or Statistics)
  • Being able to calculate the permutations \({}_{n}\mathrm{P}_{r}\) and combinations \({}_{n}\mathrm{C}_{r}\) without repetition
  • Being able to explain that combinations are "permutations divided by \(r!\) to remove the repeats caused by order"
  • Being able to simplify a value such as \({}_{6}\mathrm{C}_{4}\) to \(\dfrac{6 \times 5}{2 \times 1}\) and work it out by hand

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the permutations with repetition nΠr
Number of kinds n 10
Items to arrange r 4
Permutations with repetition nΠr =B1^B2
Table to find the combinations with repetition nHr
Number of kinds n 3
Items to choose r 5
Places for circles and bars =B1+B2-1
Combinations with repetition nHr =COMBIN(B3,B2)
Table to find the distinguishable permutations
Total letters n (TOMATO) 6
Number of Ts 2
Number of Os 2
Number of Ms 1
Number of As 1
Arrangements N =FACT(B1)/(FACT(B2)*FACT(B3)*FACT(B4)*FACT(B5))
After pasting, the upper rows are your inputs and the last row is calculated automatically.
"^" is the power symbol, FACT is the factorial, and COMBIN is the Excel function for combinations (nCr).
The first table is the 4-digit PIN from the 10 digits 0 to 9, and B3 shows 10000.
The second table is buying 5 bottles from 3 kinds of juice. B3 shows 7 (= 3 + 5 − 1) and B4 shows 21.
The third table rearranges "TOMATO", and B6 shows 180. If there are more kinds of repeated letters, multiply in more FACT terms in the denominator. =MULTINOMIAL(B2,B3,B4,B5) also gives the same 180.
Note that Excel keeps only 15 significant digits, so when the answer has 16 or more digits, the last digits are rounded.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the permutations with repetition nΠr
Number of kinds n 10
Items to arrange r 4
Permutations with repetition nΠr =B1^B2
Table to find the combinations with repetition nHr
Number of kinds n 3
Items to choose r 5
Places for circles and bars =B1+B2-1
Combinations with repetition nHr =COMBIN(B3,B2)
Table to find the distinguishable permutations
Total letters n (TOMATO) 6
Number of Ts 2
Number of Os 2
Number of Ms 1
Number of As 1
Arrangements N =FACT(B1)/(FACT(B2)*FACT(B3)*FACT(B4)*FACT(B5))
The same formulas as in Excel work as is (FACT, COMBIN and MULTINOMIAL have the same names in Google Sheets).
Copy the whole table, paste it into cell A1, and change the numbers to fit your situation.

How to calculate it in Python

import math
from collections import Counter

# 1) permutations with repetition (choose r from n kinds with repeats allowed, and order matters)
kinds = 10                       # number of kinds n (the 10 digits 0-9)
picks = 4                        # number of items to arrange r (4 digits)
repeated_permutations = kinds ** picks

# 2) combinations with repetition (choose r from n kinds with repeats allowed, order does not matter)
juice_kinds = 3                  # number of kinds n (3 kinds of juice)
bottles = 5                      # number of items to choose r (5 bottles)
repeated_combinations = math.comb(juice_kinds + bottles - 1, bottles)

# 3) distinguishable permutations (rearranging a word with repeated letters)
word = "TOMATO"
letter_counts = Counter(word)
same_item_permutations = math.factorial(len(word))
for count in letter_counts.values():
    same_item_permutations //= math.factorial(count)

print(f"Permutations with repetition (arrange {picks} from {kinds} kinds): {repeated_permutations}")
print(f"Combinations with repetition (choose {bottles} from {juice_kinds} kinds): {repeated_combinations}")
print(f"Rearrangements of {word}: {same_item_permutations}")
Runs with the standard library only (math.comb needs Python 3.8 or later). Running it shows 10000, 21 and 180. Python integers have no limit on the number of digits, so the answer stays exact even with hundreds of digits. Change the numbers and the word at the top and run it.

How to write it in LaTeX and other math languages (copy and paste)

Permutations with repetition \({}_{n}\Pi_{r}\) (arranging \(r\) items, repeats allowed)
ₙΠᵣ = nʳ
{}_{n}\Pi_{r} = n^{r}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mmultiscripts>
      <mi>&#x03A0;</mi>
      <mi>r</mi><none/>
      <mprescripts/>
      <mi>n</mi><none/>
    </mmultiscripts>
    <mo>=</mo>
    <msup><mi>n</mi><mi>r</mi></msup>
  </mrow>
</math>
n^r
n^r
repeatedPermutation := n^r;
repeated_permutation = n^r;
n^r
Combinations with repetition \({}_{n}\mathrm{H}_{r}\) (choosing \(r\) items, repeats allowed)
ₙHᵣ = ₙ₊ᵣ₋₁Cᵣ
{}_{n}\mathrm{H}_{r} = {}_{n+r-1}\mathrm{C}_{r} = \dfrac{(n+r-1)!}{r!\,(n-1)!}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mmultiscripts>
      <mi>H</mi>
      <mi>r</mi><none/>
      <mprescripts/>
      <mi>n</mi><none/>
    </mmultiscripts>
    <mo>=</mo>
    <mmultiscripts>
      <mi>C</mi>
      <mi>r</mi><none/>
      <mprescripts/>
      <mrow><mi>n</mi><mo>+</mo><mi>r</mi><mo>&#x2212;</mo><mn>1</mn></mrow><none/>
    </mmultiscripts>
  </mrow>
</math>
H(n, r) = C(n+r-1, r)
Binomial[n + r - 1, r]
nHr := binomial(n + r - 1, r);
nhr = nchoosek(n + r - 1, r);
H(n,r) = C(n+r−1, r) = (n+r−1)!/(r!(n−1)!)
Distinguishable permutations (rearranging items that include identical ones)
N = n! ÷ (p! × q! × r! × ⋯)
N = \dfrac{n!}{p!\,q!\,r!\cdots}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>N</mi>
    <mo>=</mo>
    <mfrac>
      <mrow><mi>n</mi><mo>!</mo></mrow>
      <mrow>
        <mi>p</mi><mo>!</mo>
        <mi>q</mi><mo>!</mo>
        <mi>r</mi><mo>!</mo>
        <mo>&#x22EF;</mo>
      </mrow>
    </mfrac>
  </mrow>
</math>
N = (n!)/(p!q!r!cdots)
Multinomial[p, q, r]
N := factorial(n)/(factorial(p)*factorial(q)*factorial(r));
N = factorial(n)/(factorial(p)*factorial(q)*factorial(r));
N = n!/(p!q!r!⋯)

How to have ChatGPT  do the calculation

You are a calculation assistant for counting (permutations and combinations). Do the following 3 calculations by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

1. How many 4-digit PINs can be made from the 10 digits 0 to 9? (The same digit can be used any number of times.)
2. How many ways are there to buy 5 bottles from 3 kinds of juice, with any number of each kind allowed? (Count only how many of each kind, not the order of choosing.)
3. How many different strings can be made by rearranging the 6 letters of "TOMATO"?

For each, say whether you used permutations with repetition, combinations with repetition or distinguishable permutations, explain why, and show the numbers from the execution result. In Python, use the math module (math.comb and math.factorial) and collections.Counter.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.