# Problem 118 Solution

The number of ways you can choose 7 out of 13 pirates is 13!/(7!*6!) = 1716, where x! = 1*2*...*x.

Next put 1716 locks on the safe, one for each way to group 7 pirates. For each lock give 7 keys to a unique group of 7 pirates. This way any given lock will have a keyholder in any group of 7 or more. For any group of 6 there will be exactly one lock in which the other 7 pirates have the key. Obviously any group of less than 6 would also be missing at least one key to at least one lock.

Here are the number of keys required for other numbers of pirates:

```Number
of
Pirates   Number of Locks
------- -------------------
3	                  3
5	                 10
7	                 35
9	                126
11	                462
13	              1,716
15	              6,435
17	             24,310
19	             92,378
21	            352,716
23	          1,352,078
25	          5,200,300
27	         20,058,300
29	         77,558,760
31	        300,540,195
33	      1,166,803,110
35	      4,537,567,650
37	     17,672,631,900
39	     68,923,264,410
41	    269,128,937,220
43	  1,052,049,481,860
45	  4,116,715,363,800
47	 16,123,801,841,550
49	 63,205,303,218,876
51	247,959,266,474,050
53	973,469,712,824,060
```
Michael Shackleford, A.S.A.