3
$\begingroup$

I'm seeking a solution of one of the most complicated Math problem of my life.

Here it is :

First we need to figure out how many strings of set [a-zA-Z0-9] (Which is 26 Small Letters, 26 Capital Letters, and 0 to 9 digits] Are possible to construct of length 32 characters.

Then we need to subtract these 3 out of our result.

  1. Possible 32 character strings which has only small letters. [a-z]
  2. Possible 32 character strings which has only big letters. [A-Z]
  3. Possible 32 character strings which has only digits. [0-9]

Let me know if any questions.

  • 0
    Do you mean #(strings with at least one of the three types of characters)?2017-02-05
  • 0
    YES. Apology if I made the problem sound more complicated.2017-02-05
  • 1
    Example of strings are : yXgZxJsaRG8o7EBMCXknL6XFW7V9Smmg , x8k9Ifp9ejbEYzyt2TPdkZfY1T5fZNJm , C958NV3IN3m18jVBgrtBkWdSigaDVZao2017-02-05
  • 1
    This is a nice question. What sorts of approaches have you considered?2017-02-05
  • 0
    I tried to figure out the possible combinations of n = 62, r = 32. Which gives me this number 450,883,717,216,034,000. But I don't think I'm going the right way.2017-02-05
  • 1
    @dxiv I'm only ok at maths till a certain level. And this question is like puzzle of my life I can't figure out till now.2017-02-05
  • 0
    @ViratChoudhary Sorry, had a typo in my previous hint. What I meant is that for a string with 3 characters using only the 10 decimal digits, you first choose the first digit, out of $10$ choices. Then, for each of the choices made for the first digit, you now choose the second digit out of $10$ choices. At this point, you have $100=10^2$ possible strings. Now you add the $3^{rd}$ digit and repeat, you'll have $10^3$ possible strings. This works the same for longer strings $\gt 3$, and for larger character sets $\gt 10$.2017-02-05

3 Answers 3

14

Please let me know if I have grossly misinterpreted the problem.

It seems clear to me that we are allowed to repeat letters and numbers. Then, for each slot in our $32$-character string, we have $62$ choices, adding all of the options together ($26$ letters, both upper and lower case, and the $10$ numbers).

Since there are $32$ characters and repetition is allowed, we come to $62^{32} = 2272657884496751345355241563627544170162852933518655225856$ possibilities. Good lord. According to Wolfram Alpha, that is roughly 43 million times the number of possible chess positions. Good lord.

For strings made entirely of capital letters, we have $26^{32}=1901722457268488241418827816020396748021170176$ possibilities. This is also true for the lowercase letters.

Similarly, there are $10^{32}=100000000000000000000000000000000$ possible $32$-element strings of just digits.

So, your answer, apparently, is $62^{32}-2(26)^{32}-10^{32} = 2272657884492947900440704487144706514530812140022612885504$.

  • 6
    Well **count**ed.2017-02-05
  • 6
    @CarstenS Ah! Ah! Ah!2017-02-05
7

Let $U,L,D$ be the sizes of the sets of strings containing only uppercase letters (26 usable characters), lowercase letters (26) or digits (10) respectively. Then the number of admissible strings is $$62^{32}-U-L-D=62^{32}-2\cdot26^{32}-10^{32}$$ $$=2.272\dots×10^{57}$$

  • 0
    I got the impression the OP just wanted to exclude strings of *only* capitals, *only* lowercase, and *only* numbers.2017-02-05
  • 0
    @TheCount Right, fixed that. All come to one answer.2017-02-05
  • 0
    The alphabet size is 26 (a-z or A-Z, no punctuation or spaces included), not 36.2017-02-05
  • 0
    @GreyMatters I used "alphabet" here in a computer science sense to mean "number of usable characters", but I've swapped the latter in.2017-02-05
  • 0
    You and I still have different answers.2017-02-05
  • 0
    @TheCount Done, fixed, now don't downvote on haste.2017-02-05
  • 0
    Haha, I didn't downvote! And now I will UPvote!2017-02-05
5

First, there are the following possibilities for strings:

  • 32-character strings containing only small letters
  • 32-character strings containing only capital letters
  • 32-character strings containing only digits
  • 32-character strings containing only small letters and capital letters
  • 32-character strings containing only small letters and digits
  • 32-character strings containing only capital letters and digits
  • 32-character strings containing small letters, capital letters and digits

So, by removing the first 3 categories, what you'll end up with is the total number of 32-character strings which combine 2 or more of the categories. Make sure that's the answer you want.

26 small letters + 26 capital letters + 10 digits = 62 characters total. For the first character in a string, you obviously have 62 possibilities. Since the next character can be the same or different, you have 62 possibilities there as well, or $62^{2}$ possibilities for 2 characters. Adding a 3rd character gives $62^{3}$ possibilities. For 32 characters, then, there's $62^{32}$ possibilities.

There are 26 possible small letters, so by the same logic, you'll get $26^{32}$ possibilities for 32 character strings containing all small letters.

The same logic and math applies to capital letter-only strings, so there's another $26^{32}$ possibilities.

For 10 different digits, 0 through 9, this works out to $10^{32}$ possibilities.

The equation you want, therefore, is:

$$62^{32}-26^{32}-26^{32}-10^{32}$$

You can get the final total on, say, Wolfram|Alpha.

Again, what you're getting is the number of possible 32-character strings containing combinations of 2 or more of the "small letter", "capital letter" and "digit" categories. It's not only important to get the total, but to understand the meaning of the result, as well.

  • 0
    I got the impression the OP just wanted to exclude strings of only capitals, only lowercase, and only numbers.2017-02-05
  • 0
    Nice! We agree! I always love having multiple explanations. +12017-02-05
  • 2
    All the answers posted at this point match, so we're all reading the question in the same way. Now the real question is whether this is actually the answer Virat Choudhary needs?2017-02-05
  • 2
    It is. Now this problem is no longer complicated to me except the number of digits in the answer haha.2017-02-05