Choose the type of arrangement and enter the number of items n. The calculator counts the ways to arrange them in a circle, with steps and a figure.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and figures
-
Circular permutations \((n-1)!\) (all \(n\) items in a circle)
-
Circular permutations \(\dfrac{{}_{n}\mathrm{P}_{r}}{r}\) (\(r\) of \(n\) items in a circle)
-
Necklace arrangements \(\dfrac{(n-1)!}{2}\) (flips count as the same)
-
Circular permutations with 2 given items side by side, \(2 \times (n-2)!\)
-
Circular permutations with 2 given items apart, \((n-1)! - 2 \times (n-2)!\)
-
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter the number of people to find how many ways \(n\) people can sit around a round table (circular permutations), \((n-1)!\)
- It also handles choosing only \(r\) of \(n\) items and arranging them in a circle, \(\dfrac{{}_{n}\mathrm{P}_{r}}{r}\)
- It finds necklace arrangements \(\dfrac{(n-1)!}{2}\), where arrangements that match when flipped over count as the same, as with a necklace (it also correctly handles \(n = 1,\ 2\), where simply dividing gives a wrong answer)
- It counts seatings where 2 given people sit next to each other, or not, with steps that treat the 2 as one block
- Answers are shown with every digit, no rounding. For long answers, an approximate value such as \(1.23\times10^{35}\) is added so you can see the size at a glance
- Figures of rotating circles show why \(n!\) is divided by \(n\). Copy-and-paste formulas for Excel, Google Sheets and Python are also on this page
What is this calculation used for?
At a round table, turning the whole table does not change who sits next to whom. So the number of seating plans is not the \(n!\) of a row but the circular permutations \((n-1)!\). That is 120 ways for 6 people and 5,040 ways for 8 people.
Requests like "seat these 2 together (or apart)" change the count a lot. With 6 people, there are 48 ways with 2 given people side by side and 72 ways with them apart. Instead of guessing, you can know exactly how many seating plans an event planner has to choose from.
Think of a route that visits \(n\) places once each and returns to the start, counting the depot as one of the stops. The same route is the same ring no matter where you start (rotation), and if each road is the same distance in both directions, driving it the other way gives the same distance (flipping). So the number of different routes is the same as the necklace arrangements, \(\dfrac{(n-1)!}{2}\).
With 10 stops including the depot, there are 181,440 routes, and with 15 stops, about \(4.36\times10^{10}\). Trying them all to find the shortest is not realistic, so route planning software uses clever shortcuts (optimization methods). This count is the reason why "just check every route" does not work.
The number of designs for stringing \(n\) beads of different colors or shapes into a loop is the necklace arrangements, \(\dfrac{(n-1)!}{2}\). A loop is the same piece whether you turn it or flip it, so the circular permutations are divided by \(2\) again. That is 12 designs for 5 beads and 60 designs for 6 beads.
But if the piece has a front and a back that can be told apart and cannot be worn flipped, for example beads with a pattern on one side only, flips cannot count as the same. Then you do not divide by \(2\) and count the circular permutations \((n-1)!\) instead (120 for 6 beads). Whether it can be flipped alone doubles the number of designs.
In many games, turns go around the table in one direction. The pattern of "who plays after whom" does not change if you rotate all the seats, so it is a circular permutation, \((n-1)!\). That is 6 patterns for 4 players and 24 for 5 players.
In games where going first is an advantage, you may also want to tell apart who starts. Then multiply the \((n-1)!\) turn patterns by the \(n\) choices of first player to get \(n!\) (24 for 4 players). Keeping "just the seating order" and "including the first player" separate makes it easier to think about fair ways to decide.
A rotation that goes through the list in order and returns to the top at the end is the same cycle no matter who starts, so it is counted as a circular permutation. A rotation of 5 people has \((5-1)! = 24\) possibilities.
Add the condition "these 2 must not be back to back (side by side)", and you subtract the cases where they are side by side from the total: \((n-1)! - 2 \times (n-2)!\). For 5 people, this narrows it down to 24 − 12 = 12. The formula shows clearly how adding a single condition cuts the choices in half.
Formulas and figures
Symbols and terms
Symbols
| \(n\) | en | The total number of items to arrange. It comes from "number" and is widely used for counts. On this page it is the number of people at a round table or the number of beads on a ring. |
| \(r\) | ar | The number of items chosen from the \(n\) and actually arranged. It is used together with \(n\), as in \({}_{n}\mathrm{P}_{r}\), read "\(r\) of \(n\)". |
| \(n!\) | n factorial | The factorial, \(n! = n \times (n-1) \times \cdots \times 2 \times 1\), the number of ways to arrange all \(n\) items in a row. The exclamation mark notation is said to have been introduced in 1808 by the French mathematician Christian Kramp. By definition, \(0! = 1\). |
| \({}_{n}\mathrm{P}_{r}\) | n P r | Permutations. The number of ways to choose \(r\) of \(n\) items and arrange them in a row, calculated as \({}_{n}\mathrm{P}_{r} = n \times (n-1) \times \cdots \times (n-r+1)\). \(\mathrm{P}\) stands for "permutation". It is also written \(P(n, r)\). |
| \(N\) | capital N | The letter used on this page for the number of circular permutations. It is the capital first letter of "number" and is often used for a count you want to find. |
| \(M\) | em | The letter used on this page for the number of necklace arrangements. It is the letter next to \(N\), used when you need another count separate from \(N\). |
| \(A,\ B\) | A, B | On this page, \(A\) is the number of arrangements with 2 given items side by side, and \(B\) is the number with them apart. Letters from the start of the alphabet are customarily used for fixed quantities you want to find. |
| \((n-1)!\) | n minus 1 factorial | The expression for the number of circular permutations. It is what remains after removing the \(n\)-fold repeats from rotations when \(n\) items are arranged in a circle. Thinking "fix one item and arrange the other \(n-1\)" gives the same expression. |
Terms
| number of ways | How many different ways there are in total to do something that meets a condition. Any question that asks "how many ways?" is asking for the number of ways (counting). |
| permutation | An arrangement of items where order matters, or the number of such arrangements. Arranging in a row is called a linear permutation and is counted with \({}_{n}\mathrm{P}_{r}\). |
| linear permutation | An ordinary permutation in a straight row, called this to set it apart from a circular permutation. A row has ends, so shifting it gives a different arrangement. |
| circular permutation | An arrangement of items in a circle (a ring). By rule, arrangements that match after a rotation count as the same 1 way, so \(n\) items give \((n-1)!\) ways. |
| necklace arrangement | A circular permutation where arrangements that match after a flip also count as the same 1 way. It is used for rings you can turn over, such as necklaces and bracelets, and gives \(\dfrac{(n-1)!}{2}\) ways when \(n\) is \(3\) or more. (In advanced combinatorics, this case is also called a bracelet.) |
| factorial | The product of all the whole numbers from \(1\) to \(n\) (written \(n!\)). It equals the number of ways to arrange \(n\) items in a row, and it grows explosively as \(n\) increases (\(10! = 3{,}628{,}800\)). |
| match by rotation | When turning a ring as it is makes it exactly the same as another arrangement. In circular permutations, such arrangements are not told apart and count as the same 1 way. One full turn gives \(n\) matching arrangements. |
| match by flipping | When turning a ring over (reversing left and right, as in a mirror) makes it the same as another arrangement. In necklace arrangements, these also count as the same 1 way. |
| treat as a block | Tying together the items that must be side by side and handling them as a single item. The total count goes down by 1, and at the end you multiply by the number of orders inside the block. |
| complement | All the cases where a condition does not happen, written \(A^c\). A condition that is hard to count directly, such as "not side by side", is found by subtracting the "side by side" cases from the total. |
| overcounting | Counting the same thing two or more times. In circular permutations, each ring is counted \(n\) times, so you divide by \(n\) at the end to remove the repeats. |
| fix one item | A standard way to think about circular permutations. Once one person's position is decided first, the arrangement can no longer be rotated into another one, so it is the same as arranging the other \(n-1\) items in a row. |
| multiplication principle | The counting rule that if there are \(a\) ways to decide A, and for each of them \(b\) ways to decide B, then there are \(a \times b\) ways in total. It is also called the fundamental counting principle. Multiplying the circular permutations of the block by the \(2\) orders uses this rule. |
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.
| Basic counting (Grade 7 to high school) |
|
| Permutations and factorials (high school, Algebra 2 or Statistics) |
|
| Using division to remove repeats (Grades 3–5) |
|
| Rotations and symmetry of shapes (Grades 4–8) |
|
| The complement (high school, Statistics) |
|
How to calculate it in Excel
| Number of items n | 8 |
| Circular permutations (n−1)! | =FACT(B1-1) |
| Total items n | 8 |
| Number in the circle r | 3 |
| Ways in a row nPr | =PERMUT(B1,B2) |
| Circular permutations nPr÷r | =B3/B2 |
| Number of items n | 5 |
| Necklace count | =IF(B1<=2,1,FACT(B1-1)/2) |
| Number of items n | 6 |
| No condition (n−1)! | =FACT(B1-1) |
| 2 side by side 2×(n−2)! | =2*FACT(B1-2) |
| 2 apart | =B2-B3 |
FACT calculates the factorial (n!) and PERMUT calculates the permutations (nPr).
The first table is 8 people at a round table, and the answer is 5040.
The second table seats 3 of 8 people at a round table: nPr is 336, and dividing by r gives 112.
The IF in the third table handles the case where n is 2 or less, when you must not divide by 2. Enter 5 for n and you get 12.
The fourth table is the example of 6 people at a round table: 120 with no condition, 48 side by side and 72 apart.
How to calculate it in Google Sheets
| Number of items n | 8 |
| Circular permutations (n−1)! | =FACT(B1-1) |
| Total items n | 8 |
| Number in the circle r | 3 |
| Ways in a row nPr | =PERMUT(B1,B2) |
| Circular permutations nPr÷r | =B3/B2 |
| Number of items n | 5 |
| Necklace count | =IF(B1<=2,1,FACT(B1-1)/2) |
| Number of items n | 6 |
| No condition (n−1)! | =FACT(B1-1) |
| 2 side by side 2×(n−2)! | =2*FACT(B1-2) |
| 2 apart | =B2-B3 |
How to calculate it in Python
from math import factorial, perm
n = 8 # number of items
r = 3 # number to arrange in the circle (when choosing from n)
# circular permutations: all n items in a circle
circular = factorial(n - 1)
# circular permutations: r of n items in a circle
circular_select = perm(n, r) // r
# necklace arrangements: flips count as the same
# when n is 1 or 2, flipping does not change the arrangement, so it is 1 way without dividing by 2
necklace = 1 if n <= 2 else factorial(n - 1) // 2
# circular permutations with 2 given items side by side / apart (for n of 3 or more)
adjacent = 2 * factorial(n - 2)
not_adjacent = factorial(n - 1) - adjacent
print(f"Circular permutations: {circular}")
print(f"Circular permutations of {r} of {n}: {circular_select}")
print(f"Necklace arrangements: {necklace}")
print(f"Side by side: {adjacent} Apart: {not_adjacent}")
How to write it in LaTeX and other math languages (copy and paste)
N = n! ÷ n = (n−1)!
N = \frac{n!}{n} = (n-1)!
<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>
<mi>n</mi>
</mfrac>
<mo>=</mo>
<mo>(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo>)</mo><mo>!</mo>
</mrow>
</math>
N = (n!)/n = (n-1)!
N = (n - 1)!
N := (n-1)!;
N = factorial(n-1);
N = n!/n = (n-1)!
N = ₙPᵣ ÷ r
N = \frac{{}_{n}P_{r}}{r}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>N</mi>
<mo>=</mo>
<mfrac>
<mrow><mmultiscripts><mi>P</mi><mi>r</mi><none/><mprescripts/><mi>n</mi><none/></mmultiscripts></mrow>
<mi>r</mi>
</mfrac>
</mrow>
</math>
N = (nPr)/r
N = (n!/(n - r)!)/r
N := numbperm(n, r)/r;
N = nchoosek(n,r)*factorial(r)/r;
N = nPr/r
M = (n−1)! ÷ 2
M = \frac{(n-1)!}{2}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>M</mi>
<mo>=</mo>
<mfrac>
<mrow><mo>(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo>)</mo><mo>!</mo></mrow>
<mn>2</mn>
</mfrac>
</mrow>
</math>
M = ((n-1)!)/2
M = (n - 1)!/2
M := (n-1)!/2;
M = factorial(n-1)/2;
M = (n-1)!/2
A = 2 × (n−2)!
A = 2 \times (n-2)!
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>A</mi>
<mo>=</mo>
<mn>2</mn>
<mo>×</mo>
<mo>(</mo><mi>n</mi><mo>−</mo><mn>2</mn><mo>)</mo><mo>!</mo>
</mrow>
</math>
A = 2 * (n-2)!
A = 2 (n - 2)!
A := 2*(n-2)!;
A = 2*factorial(n-2);
A = 2(n-2)!
B = (n−1)! − 2 × (n−2)!
B = (n-1)! - 2 \times (n-2)!
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>B</mi>
<mo>=</mo>
<mo>(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo>)</mo><mo>!</mo>
<mo>−</mo>
<mn>2</mn>
<mo>×</mo>
<mo>(</mo><mi>n</mi><mo>−</mo><mn>2</mn><mo>)</mo><mo>!</mo>
</mrow>
</math>
B = (n-1)! - 2 * (n-2)!
B = (n - 1)! - 2 (n - 2)!
B := (n-1)! - 2*(n-2)!;
B = factorial(n-1) - 2*factorial(n-2);
B = (n-1)! - 2(n-2)!
How to have ChatGPT do the calculation
You are a calculation assistant for math (counting). Do the following calculation 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). 8 people sit around a round table. Find the following 4 things: 1. The circular permutations of all 8 people (seatings that match after a rotation count as the same 1 way) 2. The number of ways to choose 3 of the 8 people and seat them at a round table for 3 3. The necklace arrangements of 8 beads strung into a ring (arrangements that match after a rotation or a flip count as 1 way) 4. At the round table of 8, the number of seatings where 2 given people sit next to each other, and where they do not In Python, calculate exactly with the standard math module (factorial and perm), and show the formulas you used and the numbers from the execution result. Also explain why each formula has that form.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
