The numbers may be formulated exactly in terms of
f = x^3  x^2  2*x + 1
by taking
a = Mod(x,f) and b = Mod(x^2  1, f).
The quantity b has characteristic polynomial x^3  2*x^2  x + 1, the reciprocal polynomial to f.
In order to express
a^n * b^m = C1 + C2*a + C3*b,
it suffices to find the dual basis, with respect to the trace, of
[1, Mod(x, f), Mod(x^2  1, f)].
The dual basis [t1, t2, t3] with respect to [Mod(1, f), Mod(x, f), Mod(x^2, f)] is easily found (Newton's identities). The required basis is obviously
[w1, w2, w3] = [t1 + t3, t2, t3].
Then we obtain
C1 = trace(w1 * a^n * b^m), C2 = trace(w2 * a^n * b^m), C3 = trace(w3 * a^n * b^m).
We have
[w1, w2, w3] = [Mod(1/7*x^2 + 4/7, x^3  x^2  2*x + 1), Mod(1/7*x^2 + 2/7*x + 1/7, x^3  x^2  2*x + 1), Mod(2/7*x^2  1/7*x  3/7, x^3  x^2  2*x + 1)].
In particular, the row of the table in the web page for b^m is given by
trace(w1 * b^m * a^n), n = 2 to 6.
The column for a^n is given by
trace(w[1]* a^n * b^m), m = 1 to 7.
The numbers in any given row satisfy the recurrence
C_{n+3} = C_{n+2} + 2*C_{n+1}  C_{n}
while those in a given column satisfy
C_{n+3} = 2*C_{n+2} + C_{n+1}  C_{n}.
