# How Many Unique Character String Can Be Made From 62 Characters?

I'm working on a programming algorithm and need a little math help. I'm in 10th grade and I think the question I'm asking is actually a permutation and combination logic question. Okay, so I've 62 characters as follows:

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

I want to know how many unique characters can be made from this? For example, for length 1 character, there could be 62 unique characters. Length 2 character, there could be 00,01,02,03....AA,AB,AC...FA,FB,FC,FD...ZA,ZB,ZC...0A,0B,0C...,etc.

I hope you are getting me what I'm trying to say. And the maximum length of the string should be 7 characters.

So, in total, how many unique random strings can be generated from these 62 characters!?

Using $$n$$ unique characters, there are exactly $$n^k$$ strings of length $$k$$.

Think of it this way:

You have $$n$$ choices for the first character, $$n$$ for the second one... $$n$$ for the $$k$$-th one.

So the amount of options is

$$\underbrace{n·n·n\ldots n}_{k\text{ times}} = n^k$$

If you want to know the amount of strings with $$n$$ unique characters with length up to $$k$$ then you need to add:

$$n^1 + n^2 + n^3 + ... + n^k = \frac{n^{k+1}-n}{n-1}$$

• That means 62^7? Aug 15, 2014 at 13:11
• @MehulMohan there are exaclty $62^7$ strings with exactly length $7$, but if you want to include those with length $1, 2,3,4,5$ and &6& you have to add them up. Check my edit for a simpler way to compute it. Aug 15, 2014 at 13:16
• Genius! Thanks bro! Aug 15, 2014 at 13:30