6-ary words with given trace and subtrace

Here we consider the number $S(n;t,s)$ of length $n$ words $a_1 a_2\ldots a_n$ over the alphabet $\{0,1,\ldots,k-1\}$ with $k=6$ that have trace $t$ and subtrace $s$. The trace of a $k$-ary word is the sum of its digits mod $k$, i.e., $t=a_1+a_2+\cdots+a_n \pmod{k}$. The subtrace is the sum of the products of all $n(n-1)/2$ pairs of digits taken mod $k$, i.e., $s=\sum_{1\leq i\lt j\leq n} a_i a_j$.

(trace,subtrace)
$n$ (0,0) (0,1) (0,2) (0,3) (0,4) (0,5) (1,0)
(5,0)
(1,1)
(5,1)
(1,2)
(5,2)
(1,3)
(5,3)
(1,4)
(5,4)
(1,5)
(5,5)
(2,0)
(4,0)
(2,1)
(4,1)
(2,2)
(4,2)
(2,3)
(4,3)
(2,4)
(4,4)
(2,5)
(4,5)
(3,0) (3,1) (3,2) (3,3) (3,4) (3,5)
1 100 000 100 000 100 000 100 000
2 102 102 400 020 210 210 204 000
3 306 9018 939 393 393 939 9018 306
4 183624 541272 362448 362448 183624 541272 362448 362448
5 126300180 210180300 180210180 300126300 180210180 300126300 126300180 210180300
6 100814401440 100814401440 9721620972 16209721620 129612961296 129612961296 75618001080 126010801800
7 810070569072 630090727056 630090727056 810070569072 810070569072 630090727056 630090727056 810070569072
8 524884233650544 408245443239312 449284665648384 449284665648384 505444082454432 393125248842336 466564838444928 466564838444928
9 297432272160286416 262440308448252720 297432262440297432 262440297432262440 297432262440297432 262440297432262440 297432272160286416 262440308448252720
10 167961617003521658880 167961617003521658880 178459215940801762560 157464018066241555200 167961617003521658880 167961617003521658880 178459215940801762560 157464018066241555200

Examples

The two 6-ary strings of trace 0, subtrace 2 and length 2 are $\{24, 42\}$. The two 6-ary strings of trace 5, subtrace 4 and length 2 are $\{14, 41\}$. The three 6-ary strings of trace 1, subtrace 5 and length 3 are $\{115, 151, 511\}$.

Enumeration (OEIS)