AB There are 2 combinations for 2 letters
BA that are both different.
ABC BCA There are 6 combinations for 3 letters that
ACB CAB are all different.
BAC CBA
ABCD CABD There are 24 combinations for 4 letters
ABDC CADB that are all different.
ACBD CBAD
ACDB CBDA
ADBC CDAB
ADCB CDBA
BACD DABC
BADC DACB
BCAD DBAC
BCDA DBCA
BDAC DCAB
BDCA DCBA
From the previous information, I can form this table which may later help me in finding a formula:
Table 1:
Using the information from the above table, I can construct this conclusion; the formula n! (n factorial) works because, using an example of n being 4, there are 4 (n) letters to choose from at the start. Then when one letter is chosen there are 3 left. Then after another one is picked there are 2, after a further letter is chosen there is one left, and then all the letters have been chosen.
So n being 4:
4 x 3 x 2 x 1 = 24, which is 4!.
This can be shown in a simple tree diagram, using the example of 4 again:
Diagram 1:
Therefore I can predict, using the formula of n!, there are 120 combinations for 5 letters that are all the same:
5!
= 5 x 4 x 3 x 2 x 1 = 120
ABCDE
ABCED
ABDCE
ABDEC
ABECD
ABEDC
ACBDE
ACBED
ACDBE
ACDEB
ACEBD
ACEDB
ADBCE
ADBEC
ADCBE
ADCEB
ADEBC
ADECB
AEBCD
AEBDC
AECBD
AECDB
AEDBC
AEDCB
BACDE
BACED
BADCE
BADEC
BAECD
BAEDC
BCADE
BCAED
BCDAE
BCDEA
BCEAD
BCEDA
BDACE
BDAEC
BDCAE
BDCEA
BDEAC
BDECA
BEACD
BEADC
BECAD
BECDA
BEDAC
BEDCA
CABDE
CABED
CADBE
CADEB
CAEBD
CAEDB
CBADE
CBAED
CBDAE
CBDEA
CBEAD
CBEDA
CDABE
CDAEB
CDBAE
CDBEA
CDEAB
CDEBA
CEABD
CEADB
CEBAD
CEBDA
CEDAB
CEDBA
DABCE
DABEC
DACBE
DACEB
DAEBC
DAECB
DBACE
DBAEC
DBCAE
DBCEA
DBEAC
DBECA
DCABE
DCAEB
DCBAE
DCBEA
DCEAB
DCEBA
DEABC
DEACB
DEBAC
DEBCA
DECAB
DECBA
EABCD
EABDC
EACBD
EACDB
EADBC
EADCB
EBACD
EBADC
EBCAD
EBCDA
EBDAC
EBDCA
ECABD
ECADB
ECBAD
ECBDA
ECDAB
ECBBA
EDABC
EDACB
EDBAC
EDBCA
EDCAB
EDCBA
Now I will do the same again but include 2 letters that are the same in each word, starting with the simplest possible, 2 letters:
AA There is 1 combination for 2 letters that
are both the same.
AAB There are 3 combinations for 3 letters that
ABA include 2 letters the same and 1
BAA different.
AABC BAAC There are 12 combinations for 4 letters
AACB BACA that include 2 letters the same and 2
ABAC BCAA different.
ABCA CAAB
ACAB CABA
ACBA CBAA
There are 60 combinations for 5 letters that include 2 the same and 3 different.
AABCD
AABDC
AACBD
AACDB
AADBC
AADCB
ABACD
ABADC
ABCAD
ABCDA
ABDAC
ABDCA
ACABD
ACADB
ACBAD
ACBDA
ACDAB
ACDBA
ADABC
ADACB
ADBAC
ADBCA
ADCAB
ADCBA
BAACD
BAADC
BACDA
BACAD
BADAC
BADCA
BCAAD
BCADA
BCDAA
BDCAA
BDACA
BDAAC
CAABD
CAADB
CABAD
CABDA
CADAB
CADBA
CBAAD
CBADA
CBDAA
CDAAB
CDABA
CDBAA
DAABC
DAACB
DABAC
DABCA
DACAB
DACBA
DBAAC
DBACA
DBCAA
DCAAB
DCABA
DCBAA
From the previous information, I can form this table which may later help me in finding a formula. In the table below, “s” stands for the number of letters that are the same as each other. There can be more than one number for “s”, for example in this amount of letters:
AABBCC
There are 2 As, 2 Bs and 2 Cs. For this word, “s” would be 2, 2 and 2.
Here is the table:
Table 2:
Now I will do the same again but include 3 letters that are the same in each word, starting with the simplest possible, 3 letters:
AAA There is 1 combination for 3 letters that
are all the same.
AAAB There are 4 combinations for 4 letters that
AABA include 3 the same and 1 different.
ABAA
BAAA
AAABC There are 20 combinations for 5 letters
AAACB that include 3 letters the same and 2
AABAC different.
AABCA
AACAB
AACBA
ABAAC
ABACA
ABCAA
ACAAB
ACABA
ACBAA
BAAAC
BAACA
BACAA
BCAAA
CAAAB
CAABA
CABAA
CBAAA
There are 120 combinations for 6 letters that include 3 the same and 3 different:
AAABCD
AAABDC
AAACBD
AAACDB
AAADBC
AAADCB
AABACD
AABADC
AABCAD
AABCDA
AABDAC
AABDCA
AACABD
AACADB
AACBAD
AACBDA
AACDAB
AACDBA
AADABC
AADACB
AADBAC
AADBCA
AADCAB
AADCBA
ABAACD
ABAADC
ABACAD
ABACDA
ABADAC
ABADCA
ABCAAD
ABCADA
ABCDAA
ABDAAC
ABDACA
ABDCAA
ACAABD
ACAADB
ACABAD
ACABDA
ACADAB
ACADBA
ACBAAD
ACBADA
ACBDAA
ACDAAB
ACDABA
ACDBAA
ADAABC
ADAACB
ADABAC
ADABCA
ADACAB
ADACBA
ADBAAC
ADBACA
ADBCAA
ADCAAB
ADCABA
ADCBAA
BAAACD
BAAADC
BAACAD
BAACDA
BAADAC
BAADCA
BACAAD
BACADA
BACDAA
BADAAC
BADACA
BADCAA
BCAAAD
BCAADA
BCADAA
BCDAAA
BDAAAC
BDAACA
BDACAA
BDCAAA
CAAABD
CAAADB
CAABAD
CAABDA
CAADAB
CAADBA
CABAAD
CABADA
CABDAA
CADAAB
CADABA
CADBAA
CBAAAD
CBAADA
CBADAA
CBDAAA
CDAAAB
CDAABA
CDABAA
CDBAAA
DAAABC
DAAACB
DAABAC
DAABCA
DAACAB
DAACBA
DABAAC
DABACA
DABCAA
DACAAB
DACABA
DACBAA
DBAAAC
DBAACA
DBACAA
DBCAAA
DCAAAB
DCAABA
DCABAA
DCBAAA
From the previous information, I can form this table which may later help me in finding a formula:
Table 3:
From tables 1 and 2, I can devise this formula:
n! ÷ s! = c
where s is the number of letters that are the same. s can does not have to be one number, for example in this group of letters:
AABBCC
s would be 2, 2 and 2. When there is more than 1 value for s you multiply them. So using n! ÷ s! = c, I predict that the number of combinations for AABBCC is:
n! ÷ s! = c
= 6! ÷ 2! x 2! x 2!
= 720 ÷ 2 x 2 x 2
= 720 ÷ 8
= 90
Here I have tested my prediction that there will be 90 combinations for AABBCC:
AABBCC
AABCBC
AABCCB
AACCBB
AACBCB
AACBBC
ABABCC
ABACBC
ABACCB
ABBACC
ABBCAC
ABBCCA
ABCABC
ABCACB
ABCBAC
ABCBCA
ABCCAB
ABCCBA
ACACBB
ACABCB
ACABBC
ACCABB
ACCBAB
ACCBBA
ACBACB
ACBABC
ACBCAB
ACBCBA
ACBBAC
ACBBCA
BAABCC
BAACBC
BAACCB
BABACC
BABCAC
BABCCA
BACABC
BACACB
BACBAC
BACBCA
BACCAB
BACCBA
BBAACC
BBACAC
BBACCA
BBCAAC
BBCACA
BBCCAA
BCCBAA
BCCABA
BCCAAB
BCBCAA
BCBACA
BCBAAC
BCACBA
BCACAB
BCABCA
BCABAC
BCAACB
BCAABC
CAACBB
CAABCB
CAABBC
CACABB
CACBAB
CACBBA
CABACB
CABABC
CABCAB
CABCBA
CABBAC
CABBCA
CBBCAA
CBBACA
CBBAAC
CBCBAA
CBCABA
CBCAAB
CBABCA
CBABAC
CBACBA
CBACAB
CBAABC
CBAACB
CCAABB
CCABAB
CCABBA
CCBAAB
CCBABA
CCBBAA
This proves my prediction correct, because there are 90 combinations for AABBCC.