Another how many combinations question - slightly more complicated

  • Thread starter Thread starter krytie75
  • Start date Start date
  • Tags Tags
    Combinations
AI Thread Summary
The discussion revolves around calculating the total number of combinations for strings of lengths 1 to 8 using the characters a-z and 0-9, totaling 36 characters. The formula to find the total combinations is derived from summing powers of 36, specifically 36 + 36^2 + ... + 36^8. There was confusion regarding a discrepancy of 1 in the calculated results, which was clarified to be due to an incorrect application of the formula that included an extra term. Ultimately, the correct total for strings of at least length 1 is 2,901,713,047,668, excluding the empty string. The conversation highlights the importance of careful mathematical operations in combinatorial calculations.
krytie75
Messages
4
Reaction score
0
Hi. I need a little help.

I'm trying to work out how many combinations of characters there are for a string that is between 1 and 8 characters long and uses a-z (non caps) and 0-9. There are 36 useable characters and the string could be anything from simply 'a' to '99999999'. I was able to work out how many combinations there would be if there were known to be 8 characters in the string, but I'm not sure how to include all the combinations before that (1 - 7 characters long). Is there a formula for this?

Thanks in advance!
 
Mathematics news on Phys.org
krytie75 said:
Hi. I need a little help.

I'm trying to work out how many combinations of characters there are for a string that is between 1 and 8 characters long and uses a-z (non caps) and 0-9. There are 36 useable characters and the string could be anything from simply 'a' to '99999999'. I was able to work out how many combinations there would be if there were known to be 8 characters in the string, but I'm not sure how to include all the combinations before that (1 - 7 characters long). Is there a formula for this?

Thanks in advance!

It's actually simpler than you think.

How many combinations are there if it's just 1 character length? 36
Two characters in length? Well the first can be any of the 36, and the second can be any of 36 as well, so it's 362
Three characters? Again applying the same idea, we get 363
...

And so we can get the total number of combinations by adding each and every value, so we have
36+36^2+36^3+...+36^8

And just as a reminder, we can evaluate this more simply by using the formula 1+r+r^2+...+r^n=\frac{1-r^{n+1}}{1-r}
 
Hi Mentallic!

Thanks for your help, it all makes perfect sense!

One thing I'm not quite sure on though...

When I use the formula you provided at the bottom of your response, I get the answer:

2901713047669

However when I manually calculate 36+36^2+...+36^8 I get the answer:

2901713047668

Which has a difference of 1. I'm guessing this has something to do with the "1+r+r^2" bit of your formula but I'm not sure why?

Thanks again!
 
If you use the formula, you should get 2901713047668 as the answer should be. Honestly, I can't quite think where it went wrong for you so you'll have to show me what your procedure was.

edit: If I was to take a guess, you added 1 in front of the long expression to get 1+36+36^2+...+36^8 to get it in the form 1+r+r^2+...+r^n in which you then used the formula and plugged in your values as \frac{1-36^9}{1-36} and got the higher wrong answer because you forgot to take that 1 you added back out of the value.

Also, an easier way to get it into the form of that formula would be to factorize out 36 so you're then solving 36(1+36+36^2+...+36^7)=36\cdot \frac{1-36^8}{1-36} :wink:
 
Last edited:
= (1-36^8+1)/(1-36)

= (1-36^9)/(1-36)

= -101559956668415/-35

= 2901713047669

Sorry, I'm new here and don't know how to use the proper maths characters yet.
 
krytie75 said:
= (1-36^8+1)/(1-36)

= (1-36^9)/(1-36)

= -101559956668415/-35

= 2901713047669

Sorry, I'm new here and don't know how to use the proper maths characters yet.

Yep, there you go, that's why.

Well you're doing a lot better than many other new guys that come to this forum - you know how to use parenthesis properly!
 
Ahhh! I forgot my basic maths and didn't balance the equation.

Thanks Mentallic, that's really appreciated.
 
If the String Can be "" That is a string of length 0 with nothing in it then there are 2,901,713,047,669 possibilities. However you did say that it had to be of at least length one which means that "" is not a valid string combination you want to count.
Thus 2,901,713,047,668 would be your correct answer.

Just thought I would add some context to the 1 difference you were seeing between the formulas.
 
Back
Top