The Secret
Santa Problem

The definitive answer to the question: "how many combinations of secret santa pairs are there?"

So, how do you work this out?

We follow a relatively simple 3 step process.


Start with the pairs

First, you need to find out how many unique pairs there can be, by iterating through each participant and sub-iterating the remaining participants.

The below pairs would be output for the participants [a,b,c,d]:


This could also be derrived with the following formula:


Then the combinations

You will then need to run the list of unique pairs through an 'n choose k' combinational algorithm.

Some of the combinations will contain the same participant multiple times:



Then filter the combinations

As there are combinations containing the same participant multiple times, you need to remove these by filtering the list.

You will then be left with a list of all unique combinations of unique pairs:


If you want to know more about the n choose k combinational algorithm, please watch this video.

The answer!

Please try not to get too excited!


Add everyone who is taking part in secret santa.

I am afraid that at the moment we can only calculate the answer for 14 participants!
Unique Pairs
(Ignoring Known Couples)
Unique Combinations
(Ignoring Known Couples)

Unique Pairs

Unique Combinations

Sorry, we can only show 300 of the combinations...

Relationships complicate things...

Now we need to remove couples who don't want to be paired.


Add singletons into the Coupletron 3000 to couplify them.

Coupletron 3000

True love. No question!

Look at the happy couple.

It takes two to tango...

Add a potential couple to initiate coupling process.

Known Couples

Once you have coupled everyone, go back to the answer page and re-calculate the answer.