Just a little though exercise where the math is eluding me.

You have a pick a password of exactly eight characters. The universe of characters at your disposal are upper case letters (26), lower case letters (26), digits (10), and symbols (15 for this discussion). You must use at least one of each, so how many possible combinations are there?

I started with the total combinations (77^8) and then subtracted all combinations with just lowercase letters (26^8), all uppercase (26^8), just digits (10^8) and just symbols (15^8), but then I got stuck. The combinations that don’t contain at least one of each must be excluded so I have to get rid of, for example, combinations that don’t contain any letters or don’t contain any symbols, and then I thought there has to be an easier formula for this (one I knew once upon a time). Anyone want to take a shot?

How about one from 16 Uppercase, 1 form 26 lowercase, 1 from 15 Symbols and 1 forom 10 digits

26*26*15*10 the 4 from 77*

2616*15*10*77^4

Lennox

How about one from 26 Uppercase, 1 form 26 lowercase, 1 from 15 Symbols and 1 from 10 digits

26*26*15*10 then 4 from 77*

2626*15*10*77^4

26*26*15*10*77*77*77*77

Lennox

Why isn’t it:

26 x 26 x 26 x 26 x 10 x 10 x 15 x 15 = 10,281,960,000

UC x UC x lc x lc x 123 x 123 x !@# x !@#

I thought about that but it didn’t seem right to me for some reason. Perhaps I was overthinking it?

Length of password = 8

Four classes of characters, must use 2 of each

So there’s no flexibility: each slot in the password is reserved, because you must use two characters from each of four classes.

You must get one from each, so that is 26*25*15*10*

then you have to get the next 4 from a choice of 77 each time

2625*15*10*77*77*77*77

Lennox

Can’t edit…

You must get one from each, so that is 26*26*15*10*

then you have to get the next 4 from a choice of 77 each time

2626*15*10*77*77*77*77

Lennox

Lennox is right, one from each category, the rest can be mixed.

Why does it seems like I have to multiply by 8 (or something) to account for all the possibilities?

There is no need to multiply by 8… you have the eight digits already

Lennox

Oh, I see, you mean 8! (8*7*6*5*4*3*2*1)

Lennox

Ah. If it’s “you must use two of each”, then my solution is correct; otherwise, it is as simple as 26*26*15*10*77*77*77*77.

Then you have to multiply by (8*7*6*5*4*3*2*1) since the order matters.

Lennox

Does this take into account that order matters? Because this seems like the formula for when order doesn’t matter.

For example, if I simplified and needed two characters from two pools or 3 and 4 choices respectively, I could say it’s 3*4 = 12, but that’s only in that order. To get all the choices I’d have to add 4*3 to come up with 24 possibilities. No?

So let’s say my pools are {a,b,c} and {1,2,3,4}:

a1

a2

a3

a4

b1

c4

But then I’d need:

1a

1b

1c

2a

4c

Why multiply by 8! ? Wouldn’t it be 77! - 69! ?

So the final answer is 26*26*15*10*77*77*77*77*8*7*6*5*4*3*2*1

no because it in now only 8 parameters that need to be re-ordered.

Lennox

I’m getting confused. Can you restate the problem all in one comment? I think you’ve introduced some conditions that I’m leaving out.

Yes, that’s the part I was forgetting. Excellent. So now I have to calculate that

1.437e17

Excellent. Now I have to figure out how many symbols may actually be used (practically speaking), and calculate the real number.

I appreciate the help.

Sure Eric. You have to choose exactly 8 characters as a password with the following rules:

1 from uppercase letters (26)

1 from lowercase letters (26)

1 from digits (10)

1 from symbols (15 for this discussion)

In total, there are 77 characters to choose from. So Lennox properly multiplied each group for the first four slots (26*26*10*15) then multiplied that by 77^4 for the remaining 4 slots. Because order matters, that has to be multiplied by 8! for the total possibilities that fit those rules.

On my keyboard, these are the symbols that may be used without resorting to anything special:

!@#$%^&*()_-+={[}]:;"’<,>.?/~`|\

That’s 32 plus the space, so 33 in total. This makes the “real” calculation:

95^4 * 26^2 * 10 * 33 * 8! = 7.3261461874e17 combinations.

So for the number of slots (n), the formula is:

26^2 * 33 * 10 * 95^(n-4) * n!

That’s Correct…

26^2

26 upper and 26 lowercase characters

Lennox