Test your knowledge of passwords

djsfantasi

Joined Apr 11, 2010
9,163
djsfantasi, you started so well, I had high hopes, but you faded before the line. Sorry.
Ok, I think there's a flaw in my analysis of the options available for the fourth character. My approach may result in some duplicates.

Each option has 5 x 25 x 24 combinations in common. That results in 3,000 combinations.

Scenario 1 is 3000 x 4
Scenario 2 is 3000 x 3
Scenario 3 is 3000 x 2

Simplifying with some algebra, we get 3,000 x ( 4 + 3 + 2), or 3,000 x 9 (27,000)

The remainder of my analysis applies, giving us 72 x 27,000 = 1,944,000 passwords.
 

djsfantasi

Joined Apr 11, 2010
9,163
Then a contradiction exists. One, or both, of your premises must be false.
We've picked 1 character out of five vowels. In the entire alphabet, that leaves 25 characters.
We then pick any letter from those 25 characters, which leaves 24 characters
We then pick any letter from those 4 characters...
and so on.
 

joeyd999

Joined Jun 6, 2011
5,287
We've picked 1 character out of five vowels. In the entire alphabet, that leaves 25 characters.
We then pick any letter from those 25 characters, which leaves 24 characters
We then pick any letter from those 4 characters...
and so on.
But you said, in option 1, 2&3 are not vowels. Shouldn't you take that fact into account?
 

djsfantasi

Joined Apr 11, 2010
9,163
@joeyd999

I think my explanation of why I don't believe a contradiction exists nor my premises are false, also should answer "Why?" there are common combinations before picking the fourth character.
 

WBahn

Joined Mar 31, 2012
30,075
djsfantasi, you started so well, I had high hopes, but you faded before the line. Sorry.

Joey

The password must be

1 Any vowel
2 Any remaining letter after 1 is picked (vowel or consonant)
3 Any remaining letter after 2 is picked (vowel or consonant)
4 Any remaining vowel after 3 is picked
5 Any digit from 1 to 9 inclusive
6 Any remaining digit after 5 is picked

So (1) and (4) cannot be the same vowel.

And yes order does matter

VLLVNN is not the same as VVLLNN since the options are different depending upon which order is used.
VLLVNN is legal (provided no character is used more than once)
VVLLNN is not necessarily legal, since L does not have to be a vowel (even if no character is used more than once).

Both joeyd999 and my solutions required that (1) and (4) not be the same vowel. They also required that neither (1) nor (4) be the same as any vowel chosen for (2) or (3). They also require that (2) and (3) not be the same character. They also require that (5) and (6) not be the same character.

Order does NOT matter. If I give you a legal password, there is no way for you to determine which order the characters were chosen in. But let's assume that it does and walk through it explicitly.

For the first character I have one of 5 possible choices.

V - (5) = 5

For the second character, I have one of 25 possible choices, but my choice could be one of the 4 remaining vowels OR it could be one of the 21 remaining consonants. So I have two branches:

VV - (5)(4) = 20
VC - (5)(21) = 105

For the next character, if I am in the VV branch then I can either choose one of the 3 remaining vowels OR I could choose one of the 21 remaining consonants:

VVV - (5)(4)(3) = 60
VVC - (5)(4)(21) = 420

If I am in the VS branch then I can either choose one of the 4 remaining vowels or one of the 21 remaining consonants:

VCV - (5)(21)(4) = 420
VCC - (5)(21)(20) = 2100

So my branches after the third character are:

VVV - (5)(4)(3) = 60
VVC - (5)(4)(21) = 420
VCV - (5)(21)(4) = 420
VCC - (5)(21)(20) = 2100

For the fourth character, in the first branch I have 2 choices, in the second and third I have 3 choices, and in the fourth I have 4 choices:

VVVV - (5)(4)(3)(2) = 120
VVCV - (5)(4)(21)(3) = 1260
VCVV - (5)(21)(4)(3) = 1260
VCCV - (5)(21)(20)(4) = 8400

Since the final two characters are disjoint sets from the first four, we can now combine these and see that we have 11040 distinct ways of picking the first four characters. For each of these, there are 9 ways to pick the fifth character and 8 ways to pick the sixth character, for 72 distinct ways of picking the final two characters, yielding a total number of distinct passwords that is (11040)(72)=794880.
 

djsfantasi

Joined Apr 11, 2010
9,163
But you said, in option 1, 2&3 are not vowels. Shouldn't you take that fact into account?
If they are not vowels, then they must be consonants, agree? In either case, the selected character is a member of the set of remaining letters and whose selection reduces the set by one - regardless of its sub-set membership.
 

joeyd999

Joined Jun 6, 2011
5,287
...VVLLNN is not necessarily legal...
WBahn, I was not commenting upon the legality of VVLLNN wrt the original specification. What I was trying to say is that the answer is the same regardless of the order in which the analysis is done, which I think you agreed with.

Put another way, any specification that includes two vowels, two letters, and two numbers will always have the same number of permutations.

I believe this is a general rule, and I am unaware of any exceptions, as I indicated by my question to you.
 

joeyd999

Joined Jun 6, 2011
5,287
If they are not vowels, then they must be consonants, agree? In either case, the selected character is a member of the set of remaining letters and whose selection reduces the set by one - regardless of its sub-set membership.
In your option 1, the number of possible characters for the 2nd position is the number of consonants (i.e. the number of non-vowels) in the alphabet, not one less than the number of letters. I was hoping you'd recognize this for yourself.
 

WBahn

Joined Mar 31, 2012
30,075
Here's my shot...

Ok, I have assumptions beyond the explicitly stated requirements, which are that the second and third positions can also be a vowel as long as there is no repetition of characters. This is important, as it affects the options/combinations for the second and third characters. Someone not operating on this assumption may think there are only 21 or less choices for the second and third characters.

Secondly, the characters are picked in order of their position within the password. I.e., the fourth character will not be picked before the second and third characters are picked.

Now on to the problem.

It's easy to agree that we have 5 options for the first password character. (Assuming that we are not considering 'y' to be a vowel).

For the second, we have 25 options (26 less the first character chosen). Some people reduce this further, since we need another vowel for the fourth position, but there are 4 vowels left and we can pick any vowel for the second (and third) position and still satisfy the requirements.

The same logic applies to the third character, except we have one less option, given that we picked a character for the second position. Hence, we have 24 options.

The fourth character is a little tricky. Depending on the second and third charaxters, we have anywhere from 2 to 4 options. So lets calculate the combinations based on what we know so far and the various scenarios for the fourth character.

If 2&3 are not vowels, the combinations are:
5 x 25 x 24 x 4 = 12,500

If 2&3 has one vowel amongst them, the combinations are:
5 x 25 x 24 x 3 = 9,375

If 2&3 are both vowels, the combinations are:
5 x 25 x 24 x 2 = 6,250

Summing the combinations in each of the three scenarios, we get 28,125 combinations.

The combinations of the last two digits is 72 (9x8). Multiplying 28,125 x 72, we get a total number of combinations equal to 2,025,000
You are contradicting yourself when you say "if 2&3 are not vowels" because you allowed for the possibility that they were vowels when you allowed for 25 and 24 possible choices for those slots. In other words,

Of the 5 x 25 x 24 = 3000 combinations you allow for the first three, a LOT of them -- namely 900 -- DO have either 2 or 3 as a vowel. For those, you CAN'T pick any of 4 choices of vowel for the fourth character because you will end up with repeats in many of them.

Reduce it to a toy problem to see this:

You have a three character password. The first and third characters must be chosen from {1,2,3} while the middle one can be chosen from {1,2,3,4,5}. No character can appear more than once.

Now, joeyd999 and I are saying that it does not matter what order they are picked provided the constraints are met. So we can pick any one of 3 for the first one, then any one of 2 for the third one, and then any of the 3 remaining characters for the second one, giving us a total of 18 possible passwords.

Using your reasoning, there would be:

First two characters 3*4=12, and then for the third character you would go:

If (2) is not in {1,2,3}
3*4*2 = 24
If (2) is in {1,2,3}
3*4*1 = 12

For a total of 36 possible passwords.

Now, lets pick them, in order, and then count up how many there are:

123
132
142
143
152
153
213
231
241
243
251
253
312
321
341
342
351
352

That's 18.

If you are correct, there are 18 more legal passwords. What's one of them?
 

WBahn

Joined Mar 31, 2012
30,075
WBahn, I was not commenting upon the legality of VVLLNN wrt the original specification. What I was trying to say is that the answer is the same regardless of the order in which the analysis is done, which I think you agreed with.

Put another way, any specification that includes two vowels, two letters, and two numbers will always have the same number of permutations.

I believe this is a general rule, and I am unaware of any exceptions, as I indicated by my question to you.
I was responding to studiot, not you. I'm agree with you. The exception would be if the rules meant that you a character can appear more than once, as long as they aren't next to each other. This is a stupid password rule that quite a few real systems impose.
 

djsfantasi

Joined Apr 11, 2010
9,163
Ok, last try :D

Scenario 1 is that the second and third characters are not vowels. 26 letters less the 5 vowels is a set of 21 characters. Once one is picked there are 20 remaining to choose for the third character.
5 x 21 x 20 x 4 = 8,400

In the case where one of the second and third characters is a vowel (the two cases mirror each other), there are 4 vowels left to choose for the second/third character and 21 non-vowels left for the other position. This leaves 3 vowels for the fourth position. The number of combinations is multiplied by two to account for the vowel being in the second or third position.
5 x 4 x 21 x 3 x 2 = 2,520

In the last scenario, all characters are vowels, so the combinations are simply as follows:
5 x 4 x 3 x 2 = 120

This leaves a total of 11,040 combinations, times the 72 combinations of digits, for a total of 794,880 passwords.

I think my last mistake was overlapping my combination sets (such as using an ordinl of 25, when I stated that there are 5 (vowels) not in the set). That, and jumping to conclusion that my branches were independent, when in fact my calculations showed otherwise.

Its getting late, so this is my last attempt.
 

WBahn

Joined Mar 31, 2012
30,075
And your last attempt agrees with joeyd999 and myself. So we will see what studiot has to say when he posts his solution sometime tomorrow.
 

WBahn

Joined Mar 31, 2012
30,075
Well, studiot might say that answer is exactly twice the correct answer.
I found the original site where studiot was helping someone with this problem (I didn't 'cheat' with it. )
http://www.scienceforums.net/topic/86467-help-with-permutation-problem-grade-11/
Well, then I think he will need to show how the toy problem I used earlier only has 9 possible passwords and then split the list of 18 into two sets that are duplicates.

We can make a toy problem that is basically the same as the one I gave but is a direct analogy to the first four characters of this problem: Assume an alphabet consisting of {a,b,o,u,t}. The first and fourth characters must be vowels and the inner two characters can be anything. No repeats. How many possibilities? There are 18 according to the reasoning joeyd999, myself, and now you are using. Order does not matter. The list is trivial to generate.
 

WBahn

Joined Mar 31, 2012
30,075
I just threw together a simple Python script that enumerates all of the possible passwords via brute force directly according to the rules given. The answer is 794880.

Code:
import string

vowels = 'AEIOU';
letters = string.ascii_uppercase;
digits = '123456789'

combinations = 0;
for c1 in vowels:
   pass1 = c1;
   for c2 in letters:
      if c2 not in pass1:
         pass2 = pass1 + c2;
         for c3 in letters:
            if c3 not in pass2:
               pass3 = pass2 + c3;
               for c4 in vowels:
                  if c4 not in pass3:
                     pass4 = pass3 + c4;
                     for c5 in digits:
                        if c5 not in pass4:
                           pass5 = pass4 + c5
                           for c6 in digits:
                              if c6 not in pass5:
                                 password = pass5 + c6;
                                    combinations = combinations + 1;
print(combinations);
[RANT] This new forum software SUCKS when trying to enter code. You can't even copy and paste from a text document directly into CODE tages without it removing all of the "excess" whitespace. This is just one more reason why I think it is STUPID for Python to rely on white space to determine code structure. [/RANT]

I'm more than willing to print all 794880 legal passwords to a file and challenge anyone to either find a single illegal password in there or to find a duplicate. I may even be willing to put money on it at 10:1 odds.
 

joeyd999

Joined Jun 6, 2011
5,287
I just threw together a simple Python script...
I've noticed a lot of members here use computer simulation to check their designs.

I use my designs to check the computer...

If your script had given a different answer, I would have told you there is something wrong with your computer/script.
 
Top