Here we consider the set S(n;t,s) of length n words a1a2···an over the alphabet {0,1,2,3,4} that have trace t and subtrace s. The trace of a 5-ary word is the sum of its digits mod 5, i.e. t = a1+a2+ ··· +an mod 5. The subtrace is the sum of the products of all n(n-1)/2 pairs of digits taken mod 5, i.e. s = SUM( aiaj : 1 < i < j < n ).
| (trace,subtrace) | |||||||||||||
| n | (0,0) | (0,1) (0,4) | (0,2) (0,3) | (1,0) (2,0) (3,0) (4,0) | (1,1) (2,4) (3,4) (4,1) | (1,2) (2,3) (3,3) (4,2) | (1,3) (2,2) (3,2) (4,3) | (1,4) (2,1) (3,1) (4,4) | |||||
| 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 1 | 2 | 0 | 2 | 0 | 0 | 2 | 1 | |||||
| 3 | 1 | 6 | 6 | 6 | 6 | 1 | 6 | 6 | |||||
| 4 | 25 | 20 | 30 | 20 | 25 | 20 | 30 | 30 | |||||
| 5 | 125 | 100 | 150 | 125 | 125 | 125 | 125 | 125 | |||||
| 6 | 625 | 600 | 650 | 625 | 600 | 650 | 650 | 600 | |||||
| 7 | 3025 | 3150 | 3150 | 3150 | 3150 | 3150 | 3150 | 3025 | |||||
| 8 | 15625 | 15750 | 15500 | 15500 | 15750 | 15625 | 15750 | 15500 | |||||
| 9 | 78625 | 78000 | 78000 | 78000 | 78625 | 78000 | 78000 | 78000 | |||||
| 10 | 393125 | 390000 | 390000 | 390625 | 390625 | 390625 | 390625 | 390625 | |||||
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-4,s-4(t-4))
= S(n-1;t,s) + S(n-1;t+4,s+4t+1) + S(n-1;t+3,s+3t+4) + S(n-1;t+2,s+2t+4) + S(n-1;t+1,s+t+1)
