Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have a random sequence of letters "AOKNG", and I'd like to find how many permutations of this can be formed given a character offset from 1-9.

So, offset the first character "A" 9 times would give:


= 9 permutations.

Then, offset the second for each of the first 9 permutations, and so on.

I have done this programmatically, and I have a total of 32,768 permutations. I'd like to understand how I would go about getting to this number mathematically given the above scenario.

"AOKNG" itself is not a permutation, it is the starting sequence. Take each letter of "AOKNG" and advance it x number of times up until 9. So "A" would become "B", would become "C".

Advance the first letter to "B", would become "BOKNG" (1 permutation), then repeat this nine times, replacing the first letter with C,D,E,F,G,H,I,J.

This gives us 9 permutations.

Now do the same for every letter in the starting sequence to find every possible combination of letters.

There are 9 possible values in total for each of the 5 letters in the starting sequence.

share|cite|improve this question
Not sure I understand your question. Is AOKNG one of the allowed words? In that case you have 10 permutations, counting the original . Is APKNG an allowed permutation? – Martin Argerami Nov 28 '12 at 17:07
"AOKNG" is the starting sequence. So there are 9 possible values in total for each of the 5 letters in the starting sequence. – StuR Nov 28 '12 at 17:33
But in your question you include up to JOKNG, which makes for ten permutations for the first letter. – Martin Argerami Nov 28 '12 at 18:03
up vote 2 down vote accepted

On a basic interpretation of your question, you have 10 possible characters for each position in the 5-letter word. So the total number of possible words is $10^5=100,000$.

share|cite|improve this answer
So the answer to my questions was as simple as 9^5. My calculation in my code was correct, I just missed 1 digit off so was doing 8^5 which is why I was getting 32,768 results. Anyway, thanks. – StuR Nov 28 '12 at 18:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.