# 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$.

 1 2 3 4 5 6 7 8 9 10 (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 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 2 1 0 2 4 0 0 0 2 0 2 1 0 2 1 0 2 0 4 0 0 0 3 0 6 9 0 18 9 3 9 3 9 3 3 9 3 9 3 9 9 0 18 3 0 6 18 36 24 54 12 72 36 24 48 36 24 48 18 36 24 54 12 72 36 24 48 36 24 48 126 300 180 210 180 300 180 210 180 300 126 300 180 210 180 300 126 300 126 300 180 210 180 300 1008 1440 1440 1008 1440 1440 972 1620 972 1620 972 1620 1296 1296 1296 1296 1296 1296 756 1800 1080 1260 1080 1800 8100 7056 9072 6300 9072 7056 6300 9072 7056 8100 7056 9072 8100 7056 9072 6300 9072 7056 6300 9072 7056 8100 7056 9072 52488 42336 50544 40824 54432 39312 44928 46656 48384 44928 46656 48384 50544 40824 54432 39312 52488 42336 46656 48384 44928 46656 48384 44928 297432 272160 286416 262440 308448 252720 297432 262440 297432 262440 297432 262440 297432 262440 297432 262440 297432 262440 297432 272160 286416 262440 308448 252720 1679616 1700352 1658880 1679616 1700352 1658880 1784592 1594080 1762560 1574640 1806624 1555200 1679616 1700352 1658880 1679616 1700352 1658880 1784592 1594080 1762560 1574640 1806624 1555200

## 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\}$.