Formally displays all possible variations that a scoretype in Megayahtzee can be arranged with examples and technical descriptions.

The process of calculating the total number of permutations in a given set is done by determining its factors, and then multiplying them with each other. These factors consist of 5 different types: Positional, Arrangement, Value, Excess, and Overlap. Each type of factor has its own definition of determining its value(s) from the set.

**Positional Factor**— Determined by counting the total number of ways the target values can be positioned in a given set.**Arrangement Factor**— Determined by counting the total number of ways the target values can be arranged from any single position in a given set.**Value Factor**— Determined by counting the total number of ways values can be substituted into a given set's target values and additional target values.**Excess Factor**— The range length of a given set's non-target value(s).**Overlap Factor**— Determined by finding repeated sets while working out the previous factor types.

**Target Value (A,B,C,etc.)**— A variable that is included in a given set or combo (e.g. Full House, Megayahtzee, etc.).**Non-Target Value (x)**— A variable that is not included in a given set or combo.**Additional Target Value (X,Y,Z)**— A variable that can be any of the existing target values in a given set or combo.

[A,A,A,A,x,x,x] **35**×**7**×**6**×**6**×**6**

[A,A,A,A,A,x,x] **21**×**7**×**6**×**6**

[A,A,A,A,A,A,x] **7**×**7**×**6**

[A,A,A,A,A,A,A] **7** = **58,513**

[A,A,A,A,A,x,x]
**21**×**7**×**6**×**6**

[A,A,A,A,A,A,x]
**7**×**7**×**6**

[A,A,A,A,A,A,A]
**7** = **5,593**

[A,A,B,B,B,x,x]
**21**×**10**×**7**×**6**×**5**×**5**

[A,A,B,B,B,B,x]
**7**×**15**×**7**×**6**×**5**

[A,A,B,B,B,B,B]
**21**×**7**×**6**

[A,A,A,B,B,B,x]
**7**×**20**×**7**×**6**×**5**÷**2**

[A,A,A,B,B,B,B]
**35**×**7**×**6** = **295,612**

[__A,B,C,D__,(x-1),(x-1),(x-1)]
**35**×**24**×**2**×**2**×**2**×**2**

[__A,B,C,D__,(x-2),(x-2),(x-2)]
**35**×**24**×**2**

[__A,B,C,D__,X,(x-1),(x-1)]
**21**×**10**×**6**×**4**×**2**×**2**×**2**

[__A,B,C,D__,X,(x-2),(x-2)]
**21**×**10**×**6**×**4**×**2**

[__A,B,C,D__,X,X,(x-1)]
**7**×**20**×**6**×**4**×**2**×**2**

[__A,B,C,D__,X,X,(x-2)]
**7**×**20**×**6**×**4**×**2**

[__A,B,C,D__,X,X,X]
**35**×**6**×**4**×**4**

[__A,B,C,D__,X,Y,(x-1)]
**7**×**15**×**6**×**2**×**4**×**3**×**2**×**2**÷**2**

[__A,B,C,D__,X,Y,(x-2)]
**7**×**15**×**6**×**2**×**4**×**3**×**2**÷**2**

[__A,B,C,D__,X,X,Y]
**35**×**6**×**2**×**4**×**3**×**4**

[__A,B,C,D__,X,Y,Z]
**21**×**10**×**3**×**4**×**3**×**2**×**4**÷**6**

[__A,B,C,D,E__,(x-1),(x-1)]
**21**×**120**×**2**

[__A,B,C,D,E__,X,(x-1)]
**7**×**15**×**24**×**5**×**2**

[__A,B,C,D,E__,X,X]
**35**×**24**×**5**×**3**

[__A,B,C,D,E__,X,Y]
**21**×**10**×**6**×**5**×**4**÷**2**

[__A,B,C,D,E,F__,X]
**21**×**120**×**6**×**2**

[__A,B,C,D,E,F,G__]
**5,040** = **255,360**

[__A,B,C,D,E__,(x-1),(x-1)]
**21**×**120**×**2**

[__A,B,C,D,E__,X,(x-1)]
**7**×**15**×**24**×**5**×**2**

[__A,B,C,D,E__,X,X]
**35**×**24**×**5**×**3**

[__A,B,C,D,E__,X,Y]
**21**×**10**×**6**×**5**×**4**÷**2**

[__A,B,C,D,E,F__,X]
**21**×**120**×**6**×**2**

[__A,B,C,D,E,F,G__]
**5,040** = **90,720**

[A,A,B,B,C,C,x]
**7**×**15**×**6**×**7**×**6**×**5**×**4**÷**6**

[A,A,B,B,C,C,X]
**35**×**6**×**7**×**6**×**5**÷**2** = **110,250**

[A,A,A,B,B,B,x]
**7**×**20**×**7**×**6**×**5**÷**2**

[A,A,A,B,B,B,X]
**35**×**7**×**6** = **16,170**

[A,A,B,B,C,C,C]
**35**×**6**×**7**×**6**×**5**÷**2** = **22,050**

[__A,A,B,B,C,C__,x]
**7**×**15**×**6**×**5**×**4** = **12,600**

[A,A,A,B,B,B,B]
**35**×**7**×**6** = **1,470**

[__A,B,C,D,E,F__,X]
**21**×**120**×**6**×**2**

[__A,B,C,D,E,F,G__]
**5,040** = **35,280**

[A,A,A,A,A,A,x]
**7**×**7**×**6**

[A,A,A,A,A,A,A]
**7** = **301**

[A,A,B,B,B,B,B]
**21**×**7**×**6** = **882**

[__A,B,C,D__,E,E,E]
**24**×**35**×**4**×**3**

[__A,B,C,D,D,D,D__]
**6**×**35**×**4**×**2** = **11,760**

[__A,A,B,B,C,C,D__ | D >||< A,B,C]
**21**×**10**×**3**×**2**×**3**×**2**×**4**÷**6** = **5,040**

[6,6,6,6,6,6,6] **1**

[7,6,6,6,6,6,5] **21**×**2**

[7,7,6,6,6,6,4] **35**×**3**

[7,7,6,6,6,5,5] **35**×**6**

[7,7,7,6,6,6,3] **35**×**4**

[7,7,7,6,6,5,4] **35**×**6**×**2**

[7,7,7,6,5,5,5] **35**×**4**

[7,7,7,7,6,6,2] **35**×**3**

[7,7,7,7,6,5,3] **35**×**3**×**2**

[7,7,7,7,6,4,4] **35**×**3**

[7,7,7,7,5,5,4] **35**×**3**

[7,7,7,7,7,6,1] **21**×**2**

[7,7,7,7,7,5,2] **21**×**2**

[7,7,7,7,7,4,3] **21**×**2** = **1,779**

[1,1,1,1,1,1,1] **1**

[1,1,1,1,1,1,7] **7**

[1,1,1,1,1,7,7] **21**

[1,1,1,1,7,7,7] **35**

[1,1,1,7,7,7,7] **35**

[1,1,7,7,7,7,7] **21**

[1,7,7,7,7,7,7] **7**

[7,7,7,7,7,7,7] **1** = **128**

[A,A,B,B,C,C,1 | A,B,C ≠ 1]
**21**×**10**×**3**×**6**×**5**×**4**÷**6** = **12,600**

[3,4,5,6,7,7,7]
**35**×**24** = **840**

[A,A,A,A,A,A,1 | A ≠ 1]
**7**×**6** = **42**

[__A,B,C,D,E,F,G__]
**5,040** = **5,040**

[A,A,A,A,A,A,A]
**7** = **7**

[A,B,C,D,E,F,G]
**7!**×**7**×**6**×**5**×**4**×**3**×**2**×**1**÷**5,040**

[A,A,B,C,D,E,F]
**21**×**5**×**4**×**3**×**2**×**7**×**6**×**5**×**4**×**3**×**2**÷**120**

[A,A,B,B,C,D,E]
**21**×**10**×**3**×**2**×**7**×**6**×**5**×**4**×**3**÷**12**

[A,A,B,B,C,C,D]
**21**×**10**×**3**×**7**×**6**×**5**×**4**÷**6**

[A,A,A,B,C,D,E]
**35**×**4**×**3**×**2**×**7**×**6**×**5**×**4**×**3**÷**24**

[A,A,A,B,B,C,D]
**35**×**6**×**2**×**7**×**6**×**5**×**4**÷**2**

[A,A,A,B,B,C,C]
**35**×**6**×**7**×**6**×**5**÷**2**

[A,A,A,B,B,B,C]
**35**×**4**×**7**×**6**×**5**÷**2**

[A,A,A,A,B,C,D]
**35**×**3**×**2**×**7**×**6**×**5**×**4**÷**6**

[A,A,A,A,B,B,C]
**35**×**3**×**7**×**6**×**5**

[A,A,A,A,B,B,B]
**35**×**7**×**6**

[A,A,A,A,B,B,C]
**21**×**2**×**7**×**6**×**5**÷**2**

[A,A,A,A,A,B,B]
**21**×**7**×**6**

[A,A,A,A,A,A,B]
**7**×**7**×**6**

[A,A,A,A,A,A,A]
**1**×**7** = **823,543 (7ⅇ7)**

A variable that is included in a given set or combo (e.g. Full House, Megayahtzee, etc.). The value of these variables range from 1-7. These variables are dependent on each other, as no two variables can represent the same value.

In this Full Full House set, A can represent any of the seven values, B can represent any value that is not occupied by A, and C can represent any value that is not occupied by A or B.

A variable that is not included in a given set or combo. In other words, they cannot represent a value that is already occupied by at least one target value. The value of these variables are determined by subtracting the amount of unique target values used in a given set or combo from **7**, which is the number of dice we use. These variables are independent from each other, meaning the result of one variable will not impact the result of another (they can all represent the same value, or they can all represent different values, and so on).

In this Double Triple set, there are two unique target values being used, A and B.
Therefore, the range length of x (the amount of values x can represent) is **7-2=5**.

Sometimes, there are values we do not want to let x represent, even if that value
is excluded from the set. The target values in this particular set define a Large
Straight. Typically, we would determine the amount of values x can be by doing
**7-5=2**. However, one of these two values, while it is not included in our
set, may be included in a different set, that being a Larger Straight which is written as [__A,B,C,D,E,F__].

For instance, a Large Straight consisting of these
values [1,2,3,4,5], may have two non-target values for the remainder of the whole
set, which can either be 6 or 7 for both of them. When calculating permutations,
we want to avoid overlapping with other types of sets (will be defined later). So, in order to calculate our set containing a Large Straight, we must exclude that 6 from representing our non-target values, as it forms a Larger Straight instead [1,2,3,4,5,6], which is an overlapping set where we would want its permutations calculated separately. So, we must subtract **1** from the total amount of values our non-target value can be, resulting with the term (x-1). Since the range length of x is **2**, the range length of (x-1) is **1**, for the set [__A,B,C,D,E__,(x-1),(x-1)].

The set we went through in the previous example is specifically for the case when a Large Straight is "on the edge" of the range of possible values. We must also consider the cases where straights are located "in the center" of the range.

For instance, a Small Straight of [2,3,4,5] will have three remaining values that
may be non-target values to form a whole set with seven values. The range
length of x would be **3**, and similarly to what we did in the previous example, we must exclude both 1 and 6 from the amount of possible values of x in order to
avoid overlap between other sets, such as Large Straight and Larger Straight.
Since we excluded two values from being a non-target value for the set in this example, the term (x-2) is being used.
In the context of a Large Straight, there is only one possible "center" Large Straight [2,3,4,5,6], and we must exclude values 1 and 7 for when we want to determine the possible outcomes of x that do not result in overlap. However, upon doing so we are left with no remaining values that could represent x, which makes the set [__A,B,C,D,E__,(x-2),(x-2)] impossible!

A variable that can be any of the existing target values in a given set or combo. These variables are dependent on each other, as no two variables can represent the same value.

In this set, A can represent any of the seven values, B can represent any value that is not occupied by A, C can represent any value that is not occupied by A or B, and X can represent any value that is already occupied by existing target values A, B, or C.

In this set, A, B, C, and D can represent any 4 different values that form a Small Straight, X can represent any value that is occupied by any existing target value, Y can represent any value that is occupied by any existing target value that is not occupied by X, and Z can represent any value that is occupied by any existing target value that is not occupied by X or Y.

The value of this factor is determined by counting the total number of ways the target values can be positioned in a given set. For this particular type of factor, all target values (including additional target values) in a set are treated as objects, and all non-target values are treated as empty spaces.

In this set, five of the positions are occupied by target values, and the other two positions are occupied by non-target values. Suppose we treated all target values as objects, and all non-target values as empty spaces. Let all target values = O and all non-target values = e. By substituting in these new terms we get [O,O,O,O,O,e,e]. We must determine all possible combinations of this set by moving around the objects (O's) into several different positions, which may be counted by hand, or done arithmetically. In this case, the set is small enough to be brute forced. Here are all of the positional variations of this set:

[O,O,O,O,O,e,e] [O,O,e,O,O,e,O] [O,e,e,O,O,O,O]

[O,O,O,O,e,O,e] [O,O,e,O,e,O,O] [e,O,O,O,O,O,e]

[O,O,O,O,e,e,O] [O,O,e,e,O,O,O] [e,O,O,O,O,e,O]

[O,O,O,e,O,O,e] [O,e,O,O,O,O,e] [e,O,O,O,e,O,O]

[O,O,O,e,O,e,O] [O,e,O,O,O,e,O] [e,O,O,e,O,O,O]

[O,O,O,e,e,O,O] [O,e,O,O,e,O,O] [e,O,e,O,O,O,O]

[O,O,e,O,O,O,e] [O,e,O,e,O,O,O] [e,e,O,O,O,O,O]

There are 21 different positional variations that can be made from this set. Thus, the positional factor of the set [A,A,A,B,B,x,x] is **21**.

It is also worth mentioning that the positional factor can be calculated using the combination formula. **C(n,r)**; where **n** is **7**, since there are **7** dice and **r** is the number of target values. The combination formula is as follows: **n!/(n-r)!r!** For instance, **C(7,5)** results in **21** as well.

The positional factor for this set is **1**, as there is only one possible position.

The value of this factor is determined by counting the total number of ways the target values can be arranged from any single position in a given set. The methods for determining this factor's value are sometimes done in a similar manner as the positional factor.

Using the same set from the previous example, we must determine all possible combinations of this set by arranging the target values into several different arrangements, while occupying the same five positions. Here are all of the arrangement variations for this set:

[A,A,A,B,B,x,x] [A,B,B,A,A,x,x] [A,A,B,A,B,x,x] [B,A,A,A,B,x,x] [A,A,B,B,A,x,x]

[B,A,A,B,A,x,x] [A,B,A,A,B,x,x] [B,A,B,A,A,x,x] [A,B,A,B,A,x,x] [B,B,A,A,A,x,x]

There are **10** different ways to arrange the target values in this set. Thus, the
arrangement factor of the set [A,A,A,B,B,x,x] is **10**.

The combination formula **C(n,r)** can also be used if we let **n** be the number of
target values and **r** be the number of A's. In this case, we get **C(5,3)**. This also
results in **10**.

When determining the total number of arrangements that can be made from a set
containing a straight (or any number of unique values in general), factorials are
used. The factorial (**n!**) of any positive integer **n** is equal to the product of all
positive non-zero integers less than or equal to **n**. For instance, **8!** is equal to
**8×7×6×5×4×3×2×1=40,320**. The number of possible arrangements that can be made
from this set is done by counting the number of unique target values being used,
and then taking the factorial of that number. Since there are **4** unique target
values in this set, the number of arrangements that can be made is
**4!=4×3×2×1=24**. To confirm, we can list all of the possible arrangements here:

[__A,B,C,D__,(x-2),(x-2),(x-2)] [__B,C,A,D__,(x-2),(x-2),(x-2)] [__C,D,A,B__,(x-2),(x-2),(x-2)]

[__A,B,D,C__,(x-2),(x-2),(x-2)] [__B,C,D,A__,(x-2),(x-2),(x-2)] [__C,D,B,A__,(x-2),(x-2),(x-2)]

[__A,C,B,D__,(x-2),(x-2),(x-2)] [__B,D,A,C__,(x-2),(x-2),(x-2)] [__D,A,B,C__,(x-2),(x-2),(x-2)]

[__A,C,D,B__,(x-2),(x-2),(x-2)] [__B,D,C,A__,(x-2),(x-2),(x-2)] [__D,A,C,B__,(x-2),(x-2),(x-2)]

[__A,D,B,C__,(x-2),(x-2),(x-2)] [__C,A,B,D__,(x-2),(x-2),(x-2)] [__D,B,A,C__,(x-2),(x-2),(x-2)]

[__A,D,C,B__,(x-2),(x-2),(x-2)] [__C,A,D,B__,(x-2),(x-2),(x-2)] [__D,B,C,A__,(x-2),(x-2),(x-2)]

[__B,A,C,D__,(x-2),(x-2),(x-2)] [__C,B,A,D__,(x-2),(x-2),(x-2)] [__D,C,A,B__,(x-2),(x-2),(x-2)]

[__B,A,D,C__,(x-2),(x-2),(x-2)] [__C,B,D,A__,(x-2),(x-2),(x-2)] [__D,C,B,A__,(x-2),(x-2),(x-2)]

Thus, the arrangement factor of the set [__A,B,C,D__,(x-2),(x-2),(x-2)] is **24**.

Sometimes, multiple arrangement factors are needed to determine all possible
arrangement combinations of a set. In this example, we have a Small Straight
and a 3 of a Kind representing our seven target values. We must determine the
total number of arrangements that can be made within the Small Straight and we
must also determine the total number of arrangements the three 'E' target values
can be made throughout the entire set for each Small Straight arrangement (this
can also be treated as calculating a positional factor, if we let E be our objects
and A, B, C, and D be our empty spaces). For the Small Straight, we simply compute the factorial of the number of unique target values involved in the straight, which is **4!=4×3×2×1=24**. For the 3 of a Kind, we use **n=7** and **r=3** in substitution to the combination formula **C(n,r)**, which results in **C(7,3)=35**.

Thus, the arrangement factors for the set [__A,B,C,D__,E,E,E] are **24** and **35**.
Multiplying these two factors gives us the total number of arrangements that can
be made out of this set, which is **840**.

Lastly, there are also cases where additional target values are being used in a
set. To determine the arrangement factor of a set containing additional target
values, we must make a single target value substitution for each additional target
value, and then find the arrangement factor of the resulting set. So let X be A,
and Y be B. Our new set will then be [__A,A,A,B,B,C,D__]. We proceed to calculate
this with our usual methods. In this set, there are three arrangement factors that need to be determined. The first is the total number of "positional variations" that can be made when treating the A's as our objects and B, C, and D as our empty spaces. Out of these empty spaces though, we also need to determine another total "positional variation" count by treating the B's as our objects and C and D as our empty spaces, resulting in our second arrangement factor. The third and final arrangement factor has to do with our last two unique target values, C and D.
From this set, we get **C(7,3)=35** as our first arrangement factor, **C(4,2)=6** as our
second, and **2!=2×1=2** as our third.

Thus, the arrangement factors for the set [__A,B,C,D__,X,X,Y] are **35**, **6**, and **2**.
Multiplying these three factors gives us the total number of arrangements that
can be made out of this set, which is **420**.

The value of this factor is determined by counting the total number of ways values can be substituted into a given set's target values and additional target values. As defined earlier, no two target values can hold the same value, and no two additional target values can hold the same value. The range of values that can be substituted into target/additional target values go from 1-7.

Using our beloved set we've used in the previous two factor types, there are two unique target values being used, A and B, so two value substitutions are being made. We must determine all possible pairs of values that can be substituted into A and B. By doing so, we get that A can be any of the seven values, and B can be any of the six remaining values, since one of them is already occupied by A.

Thus, the value factors for the set [A,A,A,B,B,x,x] are **7** and **6**. Multiplying these
two factors gives us the total number of different ways you can insert values into
the set's target values, which is **42**.

To determine the value factors of a set containing a straight, we must consider
the entire straight as a whole, rather than looking at its individual target values.
Meaning, a group of four different values substituted into this set's target values
will be considered as one permutation instead of four. In this set, there are a total of **4** different ways you can insert groups of four values to form a Small Straight:

[1,2,3,4,(x-1),(x-1),(x-1)] [3,4,5,6,(x-1),(x-1),(x-1)]

[2,3,4,5,(x-1),(x-1),(x-1)] [4,5,6,7,(x-1),(x-1),(x-1)]

Thus, the value factor for the set [__A,B,C,D__,(x-1),(x-1),(x-1)] is **4**... or is it?

We have to remember that there are non-target values being used in this set, specifically, (x-1)'s. This type of non-target value indicates that one of its values must be excluded from representing the non-target value to prevent overlap, as explained earlier. This further implies that the Small Straight in this set must be "on the edge" of the full range of possible values. This means we cannot take the sets [2,3,4,5,(x-1),(x-1),(x-1)] and [3,4,5,6,(x-1),(x-1),(x-1)] into consideration when determining the value factor for the set in our example, so we are left with just two sets, [1,2,3,4,(x-1),(x-1),(x-1)] and [4,5,6,7,(x-1),(x-1),(x-1)] as part of the value factor.

Thus, the value factor for the set [__A,B,C,D__,(x-1),(x-1),(x-1)] is **2**.

To determine the value factors of a set containing additional target values, we
must compute the total number of ways we can substitute the set's existing target values into them. The set in this example is composed of a Small Straight, a pair of additional target values and another unique additional target value. To determine the value factor of the three additional target values, we must find all possible ways we can substitute A, B, C, and/or D into X and Y. Here, X can represent any of the **4** target values, and Y can represent any of the **3** remaining
target values that are not already occupied by X. So, the value factors for the additional target value components of the set are **4** and **3**. Of course, we also need to find the value factor of the Small Straight itself. We have already gone through this in the previous example, but this time there are no non-target values involved. So we can go ahead and take all four of those combinations that we've brought up previously into account, making the value factor of the Small Straight component **4**.

Thus, the value factors for the set [__A,B,C,D__,X,X,Y] are **4**, **3**, and **4**. Multiplying these three factors gives us the total number of different ways you can insert values into the set's target values and additional target values, which is **48**.

The value of this factor is simply the range length of a given set's non-target value(s). In other words, it is equal to the total number of possible values that can represent each non-target value.

Again, this set is used as our example. Here, we have five target values forming
a pair and a 3 of a Kind, and two non-target values. These two variables that are
outside of the target value group can be referred to as excess, as they can be
whatever value that isn't already a target value. The excess factor of one
non-target value is just its range length, which is **5**. Basically, this is just value
factor, but for the non-target values. Since this set contains two non-target values, there will be two excess factors, both of which are **5**.

Thus, the excess factors for the set [A,A,A,B,B,x,x] are **5** and **5**. Multiplying these
two factors gives us the total number of different ways you can insert values into
the set's non-target values, which is **25**.

The value of this factor is determined by finding repeated sets while working out the previous factor types. Unlike the other four factor types, this factor divides into our overall permutation count of a given set. It primarily comes from repeated sets between the arrangement and value factors.

When working out this Double Triple set, we need to be aware of any overlap.
To do so, let's begin by solving its arrangement and value factors, along with full
lists of their possible combinations.
The arrangement factor is determined by evaluating **C(6,3)**, since there are **3** A's
and **6** target values in total. This resulted in **20** arrangements for the set.
The value factor is determined by having A represent any of the seven values
and B represent any of the six remaining values not occupied by A, resulting in
**42** different value combinations.
Now let's list out all of their sets, starting with the arrangement factors:

[A,A,A,B,B,B,x] [A,B,A,A,B,B,x] [A,B,B,A,B,A,x] [B,A,A,B,B,A,x] [B,B,A,A,A,B,x]

[A,A,B,A,B,B,x] [A,B,A,B,A,B,x] [A,B,B,B,A,A,x] [B,A,B,A,A,B,x] [B,B,A,A,B,A,x]

[A,A,B,B,A,B,x] [A,B,A,B,B,A,x] [B,A,A,A,B,B,x] [B,A,B,A,B,A,x] [B,B,A,B,A,A,x]

[A,A,B,B,B,A,x] [A,B,B,A,A,B,x] [B,A,A,B,A,B,x] [B,A,B,B,A,A,x] [B,B,B,A,A,A,x]

And here are all of the value factor sets:

[1,1,1,2,2,2,x] [1,1,1,3,3,3,x] [1,1,1,4,4,4,x] [1,1,1,5,5,5,x] [1,1,1,6,6,6,x] [1,1,1,7,7,7,x]

[2,2,2,1,1,1,x] [2,2,2,3,3,3,x] [2,2,2,4,4,4,x] [2,2,2,5,5,5,x] [2,2,2,6,6,6,x] [2,2,2,7,7,7,x]

[3,3,3,1,1,1,x] [3,3,3,2,2,2,x] [3,3,3,4,4,4,x] [3,3,3,5,5,5,x] [3,3,3,6,6,6,x] [3,3,3,7,7,7,x]

[4,4,4,1,1,1,x] [4,4,4,2,2,2,x] [4,4,4,3,3,3,x] [4,4,4,5,5,5,x] [4,4,4,6,6,6,x] [4,4,4,7,7,7,x]

[5,5,5,1,1,1,x] [5,5,5,2,2,2,x] [5,5,5,3,3,3,x] [5,5,5,4,4,4,x] [5,5,5,6,6,6,x] [5,5,5,7,7,7,x]

[6,6,6,1,1,1,x] [6,6,6,2,2,2,x] [6,6,6,3,3,3,x] [6,6,6,4,4,4,x] [6,6,6,5,5,5,x] [6,6,6,7,7,7,x]

[7,7,7,1,1,1,x] [7,7,7,2,2,2,x] [7,7,7,3,3,3,x] [7,7,7,4,4,4,x] [7,7,7,5,5,5,x] [7,7,7,6,6,6,x]

We may notice that there are some strange similarities between these lists. For instance, we see that the arrangement factor list contains [A,A,A,B,B,B,x] and [B,B,B,A,A,A,x], and the value factor list contains [1,1,1,2,2,2,x] and [2,2,2,1,1,1,x]. This may be a sign of overlap. To be certain about this, let's check by plugging in the pair of values from one of the value factor sets into both of the arrangement factor sets, do the same with the second value factor set, and then compare their results. So for the case of [1,1,1,2,2,2,x], let A = 1 and B = 2. Our arrangement factor sets [A,A,A,B,B,B,x] and [B,B,B,A,A,A,x] would become [1,1,1,2,2,2,x] and [2,2,2,1,1,1,x] respectively, post-substitution. Now let's try this with our other value factor set, [2,2,2,1,1,1,x], where we let A = 2 and B = 1.

Our arrangement factor sets [A,A,A,B,B,B,x] and [B,B,B,A,A,A,x] would become [2,2,2,1,1,1,x] and [1,1,1,2,2,2,x] respectively, post-substitution. They are the exact same sets we have got in our first case! This clearly overlaps, and we must take that information into account when we are calculating the total number of possible permutations of a set. When we applied these substitutions into our arrangement factor sets, we ended up with **4** new sets, and **2** of them were repeated/overlapping. So we have to eliminate **2/4** of all permutations, in other words, half of all of them.

Thus, the overlap factor for the set [A,A,A,B,B,B,x] is **2**, and this factor must be divided into our overall count.

For this set, we apply the same idea. We let A = 1, B = 2, and C = 3, and then we
substitute these values into the similar-looking arranged sets [A,A,C,C,B,B,x],
[B,B,A,A,C,C,x], [B,B,C,C,A,A,x], [C,C,A,A,B,B,x], and [C,C,B,B,A,A,x], as well as
[A,A,B,B,C,C,x] itself. We do the same for substitution trios (A = 1, B = 3, C = 2),
(A = 2, B = 1, C = 3), (A = 2, B = 3, C = 1), (A = 3, B = 1, C = 2), and
(A = 3, B = 2, C = 1). After a lot of substitution work we should end up with a
grand total of **36** resulting sets, with **30** of them being repeats, or overlapped sets.
Therefore, we must not take **30/36**, or **5/6** of all permutations into account, and
they must be divided out of our total permutation count for the set in this
example. In which case, we multiply the total permutation count by **1/6**, or divide
by **6**.

Thus, the overlap factor for the set [A,A,B,B,C,C,x] is **6**, and this factor must be divided into our overall count.

Turns out, there is a pattern going on when we calculate the overlap factor of
certain sets. In our first example, the set [A,A,A,B,B,B,x] has **2** unique target values each consisting of the same number of variables (both A and B have three each). The outcome was dividing the set's total permutation count by an overlap factor of **2**. In our second example, the set [A,A,B,B,C,C,x] has **3** unique target values each consisting of the same number of variables (A, B, and C all have two each). The outcome was dividing the set's total permutation count by an overlap factor of **6**.

We notice that these factors are related to the factorials of the number of unique target values that have the same number of variables each (the first set had **2** unique target values, making the overlap factor **2!=2**, and the second set had **3** unique target values, making the overlap factor **3!=6** for their respective sets). This makes sense when we consider the following: If we take a look at the set [A,B,C,D,E,F,G] (same as [__A,B,C,D,E,F,G__]), we know that there are **5,040** (or **7!**) permutations that can be made, since it is just finding all possible ways you can sort seven items. But, if we try to figure out the permutation count using our usual factor methods instead, we end up getting an arrangement factor of **7!** or **5,040** (derived from the Largest Straight), and value factors of **7×6×5×4×3×2×1=5,040** (derived from letting A be any of the seven values, B be any of the six remaining values that isn't already occupied by A, and so on). This results in a total permutation count of **5,040×5,040=25,401,600**, which is clearly wrong. But we notice that this set's target values all have one variable each! There are **7** unique target values in the set that all have the same number of variables each, so we should have an overlap factor of **7!=5,040**, and indeed, when we divide this factor into our current count of **25,401,600**, we get **25,401,600/5,040=5,040**, which is the final permutation count for the set [A,B,C,D,E,F,G].