How can I calculate the number of combinations of characters?

3.2k Views Asked by At

Given A, B, C, D, E, how can I calculate the number of potential combinations from 1 to 5 long, without duplicating any character? And always in alphabetical order. Ultimately I need to calculate this for up to 10 strings of words (alpha, beta, gamma, etc.)

A
B
C
D
E
AB
AC
...
ABCDE
1

There are 1 best solutions below

5
On

For strings of length 1, that's P(5,1)

For strings of length 2, that's P(5,2)

...

For strings of length 5, that's P(5,5).

just add them all and you get the answer.