Menage Number Calculator
Count the circular seatings of couples with partners apart and sexes alternating, with the previous value shown.
What it does
The ménage problem asks how many ways n married couples can be seated around a table so that men and women alternate and nobody sits beside their own partner. The answer for five couples is 13. For two couples it is zero, because with only four seats every arrangement puts someone next to their partner.
The problem was posed in the nineteenth century and solved after a long search for a clean formula. The standard answer is an alternating sum over a binomial coefficient, a fraction and a factorial. Each term removes the arrangements where a chosen set of couples is seated together, then adds back the cases removed twice.
This page evaluates that sum with exact integer arithmetic. The fraction inside each term is always a whole number, and the tool checks that condition before it accepts a term. Starting from n = 2 keeps the tool clear of the signed special values that the sequence uses at n = 0 and n = 1.
Alongside the count the tool shows the value for one fewer couple and the ratio between them. The sequence climbs steeply: 2, 13, 80 and 579 for four through seven couples, so the growth ratio is often above five.
The input limit is 40 couples. That produces a large integer which is printed in full, with no floating point step in the count itself. The tool reports numbers only and does not draw a seating plan.
How to use
- Enter the number of couples n from 2 to 40.
- Read the straight ménage number in the main result box.
- Check the value for one fewer couple beside it.
- Use the growth ratio to see how quickly the count rises.
- The default n = 5 reproduces the worked example.
- Try n = 4 to confirm the value 2.
Formula
- n
- The number of couples seated at the table.
- k
- The number of couples treated as adjacent in an inclusion exclusion term.
- U(n)
- The straight ménage number for n couples.
The alternating signs remove and restore overlapping cases. Rotations of the whole table are counted once because the formula fixes the relative circular order. The tool begins at n = 2 because the sequence assigns signed special values to n = 0 and n = 1 that do not describe a real seating of couples.
Worked example
Example: five couples
The page opens with n = 5.
- Set up the sum for n = 5 with k from 0 to 5.
- Compute the k = 0 term: 10 / 10 x C(10, 0) x 5! = 120.
- Compute the k = 1 term: 10 / 9 x C(9, 1) x 4! = 240, with a minus sign.
- Compute the k = 2 term: 10 / 8 x C(8, 2) x 3! = 210, with a plus sign.
- Compute the remaining terms: minus 100, plus 25 and minus 2.
- Add them: 120 - 240 + 210 - 100 + 25 - 2 = 13.
- The tool reports 13, previous value 2, and growth 6.50x.
Reference table
| n couples | U(n) | Previous | Growth |
|---|---|---|---|
| 2 | 0 | n/a | n/a |
| 3 | 1 | 0 | n/a |
| 4 | 2 | 1 | 2.00x |
| 5 | 13 | 2 | 6.50x |
| 6 | 80 | 13 | 6.15x |
| 7 | 579 | 80 | 7.24x |
| 10 | 439792 | 43387 | 10.14x |
Limits
- Men and women must alternate around the table.
- Rotations are treated as the same seating, while reflections are kept distinct.
- Inputs outside 2 through 40 are rejected.
- The ordinary ménage problem with single people and no sex alternation uses a different count.
Common mistakes
- Treating rotations as different and multiplying by the number of couples.
- Allowing a person to sit beside their own partner.
- Forgetting the alternating signs in the inclusion exclusion sum.
- Using the ordinary ménage numbers when sexes must alternate.
- Starting the recurrence at n = 1 where the sequence has a signed special value.
Try it yourself
Quick checks. Answers sit tucked under each question.
How many seatings work for five couples?
U(5) = 13, with U(4) = 2 before it, so the growth is 6.50.
What is U(4)?
U(4) = 2, meaning two circular seatings of four couples keep every partner apart with sexes alternating.
What is U(6)?
U(6) = 80 for six couples.
Questions
What is the ménage problem?
Seating couples around a table so sexes alternate and no spouse sits next to their partner.
Why is the count for two couples zero?
With four seats and alternating sexes, every arrangement puts each person beside at least one partner.
Are rotations counted separately?
No. The formula counts relative circular order, so rotating everyone does not create a new seating.
Why does the sequence start at two here?
The values at zero and one are signed conventions rather than counts of a real seating.
Are the results exact?
Yes. The inclusion exclusion sum uses integer arithmetic and each fraction is checked before use.
What is the largest number of couples?
Forty, with a clear error message for anything outside the range.