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).

$\sum _{n=1}^c \mathcal{S}_{x y}^{(n)}$ is what you're after, with $x, y, c$ the two dimensions and the number of colors. $\mathcal{S}_{x y}^{(n)}$ is the Stirling number of the second kind. 
This generalizes to arbitrary dimensions.
