Here we consider the set S(n;t,s) of length n words a1a2···an over the alphabet {0,1,2,3} that have trace t and subtrace s. The trace of a 4-ary word is the sum of its digits mod 4, i.e. t = a1+a2+ ··· +an mod 4. The subtrace is the sum of the products of all n(n-1)/2 pairs of digits taken mod 4, i.e. s = SUM( aiaj : 1 < i < j < n ).
| (trace,subtrace) | ||||||||||||
| n | (0,0) | (0,1) (2,3) | (0,2) | (0,3) (2,1) | (1,0) (3,0) | (1,1) (3,1) | (1,2) (3,2) | (1,3) (3,3) | (2,0) | (2,2) | ||
| 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 2 | 0 | 0 | 2 | 2 | 0 | 2 | 0 | 2 | 0 | ||
| 3 | 4 | 6 | 0 | 6 | 6 | 0 | 6 | 4 | 4 | 0 | ||
| 4 | 8 | 24 | 8 | 24 | 16 | 16 | 16 | 16 | 16 | 0 | ||
| 5 | 56 | 80 | 40 | 80 | 40 | 80 | 56 | 80 | 56 | 40 | ||
| 6 | 272 | 272 | 240 | 240 | 192 | 320 | 192 | 320 | 272 | 240 | ||
| 7 | 1184 | 896 | 1120 | 896 | 896 | 1184 | 896 | 1120 | 1184 | 1120 | ||
| 8 | 4763 | 3584 | 4480 | 3584 | 4096 | 4096 | 4096 | 4096 | 4608 | 4608 | ||
| 9 | 17536 | 15360 | 17536 | 15360 | 17536 | 15360 | 17536 | 15360 | 17536 | 17536 | ||
| 10 | 65792 | 65280 | 65280 | 65792 | 69632 | 61440 | 69632 | 61440 | 65792 | 65280 | ||
S(n;t,s) = S(n-1;t,s) + S(n-1;t-1,s-(t-1)) + S(n-1;t-2,s-2(t-2)) + S(n-1;t-3,s-3(t-3))
= S(n-1;t,s) + S(n-1;t+3,s+3t+1) + S(n-1;t+2,s+2t) + S(n-1;t+1,s+t+1)
