The password for the security access to a vault is a multi-character string consisting of a combination of uppercase letters, lowercase letters, digits or hyphens. The rule on creating the password is that the first character in the string must be either a digit or lowercase letter or uppercase letter. The password length has maximum characters of eight (8). How many different combinations of passwords are there?

Here Hyphen is making problem to solve . How I can fix it?


1 Answer 1


There are $63$ ($26 + 26 + 10 +1$) allowed characters. Only one is forbidden on the first place (hyphen).

So there are 62 passwords of length 1.

There are $62 \times 63$ passwords of length 2.

There are $62 \times 63 \times 63$ passwords of length 3, etc.

Now sum up to and including length 8 (and use a formula for a finite sum of this type, if you know it).

To expand on the last bit: note that for $a \neq 1$: $1 + a + a^2 + \ldots + a^k = \frac{a^{k+1}-1}{a-1}$ (proof: multiply both sides by $a-1$). In the sum, get the 62 out, and use this result to see we can write is directly as $63^8 - 1$.

The latter suggests a direct proof of that fact. Consider all sequences of all 63 allowed characters of length 8. Remove all consecutive hyphens from the start onwards. This gives all allowed passwords exactly once. The only problem is the all hyphen word, which would result in the empty password (which I assume is not allowed). Hence $63^8 - 1$.

  • $\begingroup$ That means 62*63^7 will be the answer? $\endgroup$ Commented Oct 28, 2015 at 12:21
  • $\begingroup$ @YasinArafat That is the number of exactly length 8. You need all lengths up to 8. So sum up. $\endgroup$ Commented Oct 28, 2015 at 12:22
  • $\begingroup$ 62+62*63+62*63^2+................+62*63^7 ...I think I have got you :) $\endgroup$ Commented Oct 28, 2015 at 12:26
  • $\begingroup$ @YasinArafat and this can be computed more simply using finite geometric series, if you know them... $\endgroup$ Commented Oct 28, 2015 at 12:27
  • $\begingroup$ Actually dont have idea about this .If you excuse me, will you give a sample solution with this ? By the way Thankyou :) $\endgroup$ Commented Oct 28, 2015 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .