Start with all $8$-character strings: $95^8$
Then remove all passwords with no lowercase ($69^8$), all passwords with no uppercase ($69^8$), all passwords with no digit ($85^8$) and all passwords with no special character ($62^8$).
But then you removed some passwords twice. You must add back all passwords with:
- no lowercase AND no uppercase: $43^8$
- no lowercase AND no digit: $59^8$
- no lowercase AND no special: $36^8$
- no uppercase AND no digit: $59^8$
- no uppercase AND no special: $36^8$
- no digit AND no special: $52^8$
But then you added back a few passwords too many times. For instance, an all-digit password was remove three times in the first step, then put back three times in the second step, so it must be removed again:
- only lowercase: $26^8$
- only uppercase: $26^8$
- only digits: $10^8$
- only special: $33^8$
Grand total: $95^8 - 69^8 - 69^8 - 85^8 - 62^8 + 43^8 + 59^8 + 36^8 + 59^8 + 36^8 + 52^8 - 26^8 - 26^8 - 10^8 - 33^8 = 3025989069143040 \approx 3.026\times10^{15}$
Password length is 5 or 6 characters. Characters allowed are $a-z$, $A-Z$, $0-9$.
The password must contain at least one lowercase letter, at least one uppercase letter and at least one digit.
Use the inclusion, exclusion principal. $|\{lud\}| - |\{lu\}|-|\{ld\}|-|\{ud\}| + |\{l\}|+|\{u\}|+|\{d\}|$
$$C= (26\!+\!26\!+\!10)^5(26\!+\!26\!+\!10\!+\!1)\!-\!(26\!+\!26)^5(26\!+\!26\!+\!1)\!- 2(26\!+\!10)^5(26\!+\!10\!+\!1)\!+\!2(26)^5(26\!+\!1)\!+\!(10)^5(10\!+\!1)$$
$$C= (62)^5(63) - (52)^5(53) - 2(36)^5(37) + 2(26)^5(27)+(10)^5(11)$$
$$C= 57,\!716,\!368,\!416 - 20,\!150,\!813,\!696 - 4,\!474,\!497,\!024 + 641,\!594,\!304+1,\!100,\!000$$
$$C= 57,\!716,\!368,\!416 -24,\!625,\!310,\!720 + 642,\!694,\!304$$
$$C= 33,\!733,\!752,\!000$$
but it doesn't match this:
$(26∗26∗10∗62∗62)+(26∗26∗10∗62∗62∗62)=1,637,082,720$
That only counts passwords starting with one upper case, one lower case, and one digit, --in that order-- followed by 2 or 3 more symbols from any group.
It does not count, for instance, "$\mathrm{HeLL0}$"
Best Answer
No, that won't do.
You should choose and place the digit(s), then place letters
Using $1$ digit: $\binom{10}1\cdot6\cdot{26}^5$
Using $2$ digits: $\binom{10}2\cdot6\cdot5\cdot{26}^4$ and so on.
Finally, add up