-1
$\begingroup$

The number of strings of six characters (uppercase alphabets and numbers) out of which at least one character should be a number. This problem is often solved like this:

All strings of $6$ digits made up of uppercase characters and numbers $= 36^6$.

All strings of $6$ digits with only uppercase characters = $26^6$.

Answer $= 36^6 - 26^6 = 1867866560$.

I was searching for a way to do this not through the subtraction way as above.

$\endgroup$
  • $\begingroup$ I am afraid that you won't get anything simpler than this. $\endgroup$ – Nathanael Skrepek Apr 6 '17 at 9:01
  • 1
    $\begingroup$ I don't want a simpler solution, I am just asking for one $\endgroup$ – Sanjay Apr 6 '17 at 9:02
  • $\begingroup$ add up the 1,2,3,4,5,6 number cases (obviously more complicated) $\endgroup$ – Cato Apr 6 '17 at 9:15
0
$\begingroup$

The subtraction way is definitely the right approach. If you really wanted to do it a different way the following would work.

If the first digit occurs in position 1, there are $10\times 36^5$ options (digit followed by anything). If the first digit is in position 2, there are $26\times10\times 36^4$ options (letter, digit, then anything), and so on, so the answer is

$$10\times 36^5+26\times10\times36^4+26^2\times10\times36^3+26^3\times10\times36^2+26^4\times10\times36+26^5\times 10.$$

$\endgroup$
  • $\begingroup$ I only understand this till option 1. I mean, why can't it be like this : 10x36^5 (number at first position), 36 x 10 x 36^4 (when number is at second). They all should be 10 x 36^5 why not? $\endgroup$ – Sanjay Apr 6 '17 at 9:08
  • $\begingroup$ The second case isn't "digit in second", it's "the first digit is in second", so you need a letter, then a digit, then anything. If you count "digit in first" then "digit in second", you've counted all the strings that start with two digits twice. $\endgroup$ – Especially Lime Apr 6 '17 at 9:13
  • $\begingroup$ @sanjay - the string 12AAAA would be counted by both of your cases, that is to say, double counted (or multiple counts) - try it with 3 character string, 1 letter and 1 number - you'll see how it double coubnts $\endgroup$ – Cato Apr 6 '17 at 9:13
  • $\begingroup$ @Cato That's the point I was missing. Thanks. $\endgroup$ – Sanjay Apr 6 '17 at 9:27
0
$\begingroup$

The number of upper case alphanumeric strings of length $6$ with at least one numeral is $$\sum_{k=1}^6\binom6k10^k26^{6-k}$$ where the term $\binom6k10^k26^{6-k}$ is the number of strings containing exactly $k$ numerals and $6-k$ upper case letters. Without the requirement of at least one numeral, the total number of strings is $$\sum_{k=0}^6\binom6k10^k26^{6-k}=(10+26)^6=36^6$$ by the binomial theorem, so the number of strings with at least one numeral is $$\sum_{k=1}^6\binom6k10^k26^{6-k}=\sum_{k=0}^6\binom6k10^k26^{6-k}-\binom6010^026^6=36^6-26^6.$$

Now, if you want the number of strings with at least two numerals, that is given "directly" by the sum $$\sum_{k=2}^6\binom6k10^k26^{6-k},$$ Or to make the calculation a little easier we can rewrite it as $$\sum_{k=0}^6\binom6k10^k26^{6-k}-\sum_{k=0}^1\binom6k10^k26^{6-k}=36^6-26^6-6\cdot10\cdot26^5.$$

$\endgroup$

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.