SEARCH HOME
 Math Central Quandaries & Queries
 Question from Sheila, a teacher: I have a combination lock with a total of 3 rows of single digits 1 - 9. In order to open the lock, the numbers chosen for each row together add to 12.I'm looking to generate a list of numbers that I can sequentially try so that I can open the lock.

I'm assuming that you mean "rows of single-digit numbers" as other interpretations don't make much sense.

If numbers are allowed to repeat in a row the number of possible solutions is fairly large, involving almost all ordered partitions (also called compositions) of 12, from 111111111111 to 39 and 93 [commas omitted for brevity!] There are $2^11 = 2048$ of these [think of going a long a row of 1's and inserting or not inserting breaks in any of the 11 gaps.] Only eight: {11(10), 2(10), 1(10)1, (10)11, (10)2, (11)1, 1(11), (12)} are omitted. So there are exactly 2040 choices for each row. With three rows your number is
$2040^3 = 8,489,664,000.$ I hope you don't have to try all of these!

If numbers are not allowed to repeat in a row, there are 101 choices, from 1236 (and its 23 rearrangements) to 39 and 93. You can compute this (it's messy by hand) using the online calculator at
http://www.btinternet.com/~se16/js/partitions.htm
So your total number is $101^3 = 1,030,301.$

If numbers are not allowed to repeat anywhere in the array, you have far fewer choices. The omitted digits sum to 9, so can be only one of

9, 18, 27, 126, [and four more - find them!]

Thus the digits used can be

12345678, 2345679, 1345689, 345789, [and of course four more]

Consider, for instance, the second of these digit sets, 2345679. 9 must pair with 3; with 3 already taken, 7 must pair with 5; and this leaves 246 as the third row. There are 2 ways to order 93, 2 for 75, and 6 for 246; and these three rows can be ordered in six ways; so {93,75,246} gives 132 ordered solutions, such as

9 3
7 5
2 4 6

3 9
6 2 4
5 7

and 130 more (Not very exciting at this stage...)

I leave it to you to work out the solutions for the other six sets of digits. One of them gives three sets of digits, three give none.

Good Hunting!
RD

Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences.