1
$\begingroup$

Everyone is asked to create a new 8 character password with at least one number and exactly one special character with the remaining characters being lowercase letters. How many possible passwords are available?

I don't get how to find with restrictions.

26 letters 10 numbers 9 special characters.

Please help me.

$\endgroup$
  • $\begingroup$ How many "special characters" are there? $\endgroup$ – Eric M. Schmidt Apr 19 '16 at 6:28
  • $\begingroup$ Is it with/without repetition $\endgroup$ – Archis Welankar Apr 19 '16 at 6:30
  • $\begingroup$ It is with repetition and there are 9 special characters and 10 numbers. $\endgroup$ – Sohee Apr 19 '16 at 6:32
3
$\begingroup$

We first count the number of 8-character passwords with no numbers at all, but exactly one special character. We

  • Choose the special character: $9$ ways
  • Place it: $8$ ways
  • Choose a letter for each of the remaining positions: $26^7$ ways

So we can do it in $9 \cdot 8 \cdot 26^7$ ways. Now, we count the number of 8-character passwords with exactly one special character and no restrictions on the number of numbers. We

  • Choose the special character: $9$ ways
  • Place it: $8$ ways
  • Choose a letter or a number for each of the remaining positions: $(26 + 10)^7$ ways

The number of such passwords is thus $9 \cdot 8 \cdot (26+10)^7$. If we want to count the number of passwords with at least one number, we subtract the number of passwords with no number from the total number of passwords. Hence the answer is $$9 \cdot 8 \cdot (26+10)^7 - 9 \cdot 8 \cdot 26^7 = 5063929482240$$

$\endgroup$
  • $\begingroup$ You seem to be assuming that the first symbol is a number and the second symbol is a special character. $\endgroup$ – Gerry Myerson Apr 19 '16 at 7:38
  • $\begingroup$ @GerryMyerson Sorry, overlooked it in a hurry. Edited. $\endgroup$ – shardulc Apr 19 '16 at 7:48
  • $\begingroup$ Good, but still not right. Consider a much simpler problem: 2 characters, one of which must be a number. Your reasoning gives $(10)(2)(36)=720$, but this counts the two-number passwords twice. It should be $(10)(26)+(10)(10)+(26)(10)$. $\endgroup$ – Gerry Myerson Apr 19 '16 at 8:05
  • 1
    $\begingroup$ @GerryMyerson Used a different approach. $\endgroup$ – shardulc Apr 19 '16 at 8:19
  • $\begingroup$ @trueblueanil Fixed. I'm being very careless today :) $\endgroup$ – shardulc Apr 19 '16 at 9:11
0
$\begingroup$

I am not sure whether this is the best or easiest way but here is one way to attack the problem. I will use L to represent an arbitrary letter, 9 for an arbitrary digit, and * for a special character.

Case 1 – Exactly one number

Case 1a – The letter is in position 7 and the special character is in 8 i.e. LLLLLL9* so, there are 26^6 x 10 x 9 possibilities.

Back to the general case 1, how many other arrangements are there? The digit can be in any of 8 positions and the special character in any of the other 7. So 8 x 7 x the number of 1a cases.

Case 2 – Exactly two numbers

Case 2a – the pattern LLLLL99* has 26 ^ 5 x 10 ^ 2 x 9 possibilities.

Back to general case 2, how many other arrangements? The two digits can be in 8 x 7 / 2 places and the special character in one of the remaining 6.

Case 3 etc. Continue in the same way. You will need some simple combinatorics e.g. how many arrangements of three digits, four digits, etc.

The rule appears to allow case 7: 0 letters, 7 digits and 1 special character so don’t forget that.

$\endgroup$
  • $\begingroup$ Shardluc's answer is simpler. $\endgroup$ – badjohn Apr 19 '16 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.