### Counting the Possible Plugboard Settings

The exact figure for settings of the plugboard with 10 pairs of letters connected is 150,738,274,937,250.
To see how this is worked out you must know some basic facts about permutations and combinations.

- Given n distinct objects there are n! ways of arranging them in sequence, where n! means the product n x (n-1) x (n-2)... 3 x 2 x 1.
For example the six digits 1,2,3,4,5,6 can be arranged in 6 x 5 x 4 x 3 x 2 x 1=720 different orders (bell-ringers will be familiar with this.)

- Given a set of n distinct objects there are C(n,r) ways of dividing it into two sets of size r and (n-r), where C(n,r) means
n! / r! (n-r)!

However it is not immediately obvious how we apply this to the Enigma plugboard problem where the 26 letters have to be divided into 6 unpaired letters and 10 pairs of pairwise connected letters.
One way of doing this is as follows: suppose that we had ten *differently coloured* connecting wires: red, blue, green etc etc.

Then there are C(26,2) ways of choosing a pair for the red wire. For each of these there are C(24,2) ways of choosing a pair for the blue wire, and so on,
giving the product

C(26,2) x C(24,2) x C(22,2) x ... x C(8,2)

This can be simplified, with many factors cancelling, to

26! / (6! 2^{10})

But in the actual Enigma the wires are not coloured. This means we must divide by the number of ways of permuting the 10 coloured wires, i.e. divide by a further factor of 10!. This gives the answer:

26! / (6! 10! 2^{10}) = 150,738,274,937,250.

More abstractly: the number of ways of choosing m pairs out of n objects is:

n! /((n-2m)! m! 2^{m})

If you want to convince yourself of this formula you might like to check that there are:

- 3 different ways of putting 2 pairs of wire into 4 plugboard sockets
- 15 different ways of putting 3 pairs of wire into 6 plugboard sockets.

From this formula we can find out something which often surprises people, which is that the number of possible plugboard pairings is greatest for 11 pairs, and then decreases:

1 pair: 325

2 pairs: 44,850

3 pairs: 3,453,450

4 pairs: 164,038,875

5 pairs: 5,019,589,575

6 pairs: 100,391,791,500

7 pairs: 1,305,093,289,500

8 pairs: 10,767,019,638,375

9 pairs: 58,835,098,191,875

10 pairs: 150,738,274,937,250

11 pairs: 205,552,193,096,250

12 pairs: 102,776,096,548,125

13 pairs: 7,905,853,580,625

Again, if you don't believe this can happen, have a look at the number of ways you can put 2 pieces of wire into 6 plugboard sockets: there are 45 ways, three times as many as you get with 3 wires. (Hint: imagine pulling out one of the three wires.)

Note contributed by Andrew Hodges (based on page 178 of his book Alan Turing: the Enigma.