Kinda tricky counting problem.

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 2K views
cragar
Messages
2,546
Reaction score
3

Homework Statement



A computer operating system allows files to be named using any combination of uppercase letters (A-Z) and digits (0-9) But the number of characters is at most 4 , And there must be at least 1 letter in each file name.

The Attempt at a Solution


So I break this up into 4 cases. 1 character file name , 2 character file name , 3 character file name , 4 character file name.
For the first case I just have 26 choices because it has to be a letter.
and for the second one I have 2 characters, To make sure I have at least one letter in it
I take all the possible combinations 36*36 minus the combinations with no letters
so I should have [itex]36^2-10^2[/itex] for the second one. And this pattern should continue.
So i think the answer is [itex](26)+(36^2-10^2)+(36^3-10^3)+(36^4-10^4)[/itex]
I didn't simply this so you can see my reasoning.
 
Physics news on Phys.org
You're on the right track.

In the case of only one letter, the rest are numbers, right? So that's 26*10*10*10 combinations. And there are four of those cases, because the letter can be in any of four positions. Using X as a stand-in for any letter and 9 as a stand-in for any number: X999, 9X99, 99X9, 999X.

In the case of two letters, you have six configurations: XX99, X9X9, X99X, 9XX9, 9X9X, 99XX. Each configuration contains 26*26*10*10 combinations.

In the case of three letters, you have four configurations (9XXX, X9XX, XX9X, XXX9), each containing 26*26*26*10 combinations.

In the case of four letters, you have only one configuration with 26*26*26*26 combinations.

So the total number of combinations of filenames is 4*(26^1*10^3) + 6*(26^2*10^2) + 4*(26^3*10^1) + 1*(26^4*10^0).

Hope this helps (and I hope I didn't make a mistake).