Given a matrix, each element is filled with one of the three colors: red, green or blue such that any two adjacent elements cannot have the same color. How many ways one can color this matrix (in terms of m and n)? (Already known (by enumeration method =_=): If m = n = 1, ways = 3; m = n = 2, ways = 18; m = n = 3, ways = 246… m = n = 4, ways = 7260 The pattern seems hard to predict…

The n = any but m = 1, 2, 3 cases are also known but I’ve forgotten…)