A password length can be 6 to 8 characters long, where each character is an upper case letter or a digit. each password must contain at least one digit. how many possible passwords are there?
k so to make this easier... lets look at just a 6 character long password the book says you should find the total number of possibilities and subtract away all of the possible passwords that are only alpha which would be 36^6 - 26^6 why couldn't you just force 1 of the slots to be numeric and do 36^5 * 10???
Help?
your version would be correct only if it were 5 alphanumeric characters followed by a digit at the end.
you've lost the degree of freedom of where the digit may appear, e.g. that you are allowed to have a character as the last if a number appears earlier.
help me please? you are the only one that seems to be on and i would very much be thankful for someone to help me please.
wait why though? you are using the product rule and where the slot is doesn't matter
?
doing 36^4 * 10 * 36 is the same thing
i mean with my problem above?
your rule gets all possible combinations of letters and numbers but undercounts the ways they can be permuted
36^5 * 10 is only correct if there is exactly one position that is required to have a digit, and all the other positions can be either letters or numbers
but isn't that what it's asking? A password length can be 6 to 8 characters long, where each character is an upper case letter or a digit. each password must contain at least one digit. at least 1 would mean 1 position required to be a digit and the rest could be anything, no?
bleh, easy stuff just don't want to go into the test and make a mistake like this
for a thought experiment, do this problem: how many valid passwords are there if positions 1 through 5 are all required to be a letter or number, and position 6 can only be a number?
604661760 no? isn't it the same thing?
36^5 * 10, right? that's the same answer you wanted to give for the first problem. But the password "1AAAAA" is valid for the first problem, and invalid for the second problem. thus the number of valid passwords can not be the same.
ahhh ok wait so i haven't read the chapter on combinatorics yet. Remember doing it a while back, but it's been a long time.
ok so the thought experiment is a permutation, in which order does matter right?
and the problem from the book is a combination?
36^5 * 10 is the number of valid passwords if there is one particular position (e.g. position #6) that has the digit-only restriction. this undercounts the number of valid passwords in the original problem, where the digit can be in *any* position.
i thought there might be a way to "patch" your formula by multiplying it by 5, to account for the number of places it's legal to put the digit, but that's broken too - it overcounts. i think the only way to do it correctly is the way the book said.
ah ok i think i kind of get it now. think it's just going to take some reading into the chapter on combinations/permutations to really get a handle on the subtleties to these problems
thank you very much for your help. really appreciate it
no problem
i found another way to get it
36^5*10 + 36^4*10*26 + 36^3*10*26^2 + 36^2*10*26^3 + 36*10*26^4 + 10*26^5
you will never get it with just multiplication
you want me to explain it?
what the... i dont understand why you have to do all of that
that gives the right answer but i'm also perplexed as to why
and why would you do *26 + *26^2... and so on vs doing *10 + *10^2... etc
say the first number comes in the first slot. the next 5 can be anything. that's 10*36^5
k
ohhh i see, then let's say hypothetically the first is not a number, but the second is, and the rest can be anything
if the first number comes in the 2nd slot, the first character has to be a letter. and the last 4 can be anything. 26*10*36^4
ahhhhhhhhhh
or the first two are both not numbers, and the third is, and the rest can be anyhthing
if the first number comes in the 3rd slot, the 1st 2 characters have to be letters, and the last 3 can be anything 26^2*10*36^3
haha that's clever, if unwieldy
yes, it's easier to do it the way the book did
yeah i agree but your way makes a lot more sense why the method works
ah very nice very nice. well thanks a ton fellas
Join our real-time social learning platform and learn together with your friends!