Finding all possible combination **patterns** - as opposed to all possible combinations I start off with trying to find the number of possible combinations for a 5x5 grid (25 spaces), where each space could be a color from 1-4 (so 1, 2, 3, or 4)
I do 4^25 = 1,125,899,906,842,624 different combinations
However, now I'm trying to change the number of combinations to account for grids with the same number pattern, for example:
{ 1 1 1 1 1 }
{ 3 3 3 3 3 }
{ 4 4 2 2 3 }
{ 4 3 2 1 1 }
{ 2 2 1 2 3 }
1 is now 2, 2 is now 4, 3 is now 1, 4 is now 3

{ 2 2 2 2 2 }
{ 1 1 1 1 1 }
{ 3 3 4 4 1 }
{ 3 1 4 2 2 }
{ 4 4 2 4 1 }
I'm having trouble trying to come up with an equation I can use to solve this for a (x * y) grid where each space could be a color from 1 to (c).

Assign four colours (a,b,c,d) to the values (1,2,3,4) - how many ways can this be done? $4!=24$ That is the number you need to divide by, for grids that use all four colours, and (I think) for grids that only use three colours. For grids with only one or two colours, the number of options reduces, because switching the unused colours doesn't make any difference. So for example with monochrome grids, instead of $4!=24$ options there are only $\frac{4!}{6}=4$ options (of course). For two-colour grids, there are $\frac{4!}{2}=12$ options to divide out.
