Math CentralQuandaries & Queries


Question from Kevin, a student:

How many 6 digit combinations (i.e., 159159) can be made from 3 different numbers (i.e., 1,5, and 9)? The numbers will obviously have to repeat. A link to a calculator that could list all the combinations would be helpful. I've come across these sites:, and , but am not sure how to use them for my specific case. Thanks.

Hi Kevin,

You want all strings of length 6 made from the 3 characters 1, 5 and 9. Suppose you want to construct all such strings starting from the left. You have 3 choices for the first character, it can be 1, 5 or 9. For each choice of the first character you have 3 choices for the second character. Thus you have $3 \times 3 = 3^2 = 9$ possible 2 character strings. For each of the 9 two character strings you have 3 choices for the third character and thus you have $ 3^2 \times 3 = 3^3 = 27$ possible strings of length 3. Continuing this argument you have $3^6 = 729$ possible strings of length 6.

You can list them using the Text Mechanic site. Go to and in each of the 3 object input boxes enter 3 lines. The first line is the digit 1, the second line is the digit 5 and the third line is the digit 9. If you then click on Generate Combinations you will get all 27, 3 digit strings. If you add 3 more identical object input boxes you will obtain all 729, 6 digit strings.


About Math Central


Math Central is supported by the University of Regina and the Imperial Oil Foundation.
Quandaries & Queries page Home page University of Regina