# Hankel determinants for q-Catalan numbers where q is a root of unity?

Let $${C_n}(q)$$ be the weight of the Dyck paths of semilength $$n$$ where the upsteps have weight $$1$$ and the downsteps which end on height $$i$$ have weight $$q^i$$.
They satisfy $${C_n}(q) = \sum\limits_{j = 0}^{n - 1} {{q^j}} {C_j}(q){C_{n - 1 - j}}(q)$$ with $${C_0}(q) = 1.$$

The first 3 Hankel determinants $${d_k}(n,q) = \det \left( {{C_{i + j + k}}(q)} \right)_{i,j = 0}^{n - 1}$$

are $${d_0}(n,q) = {q^{\frac{{n(n - 1)(4n - 5)}}{6}}},$$ $${d_1}(n,q) = {q^{\frac{{n(n - 1)(4n + 1)}}{6}}}$$ and $${d_2}(n,q) = {q^{\frac{{n(n - 1)(4n + 7)}}{6}}}\frac{{1 - {q^{n + 1}}}}{{1 - q}}.$$

For the higher Hankel determinants no simple formulas seem to be known.

Is there anything known for $$q$$ a root of unity which generalizes the well-known formulas for $$q=1?$$

Edit

Let me make my question more precise: For $$q=1$$ the determinants $$d_{k}(n,1)$$ satisfy $$\frac{d_{k}(n,1)}{d_{k-1}(n,1)}=\frac{\binom{2n+2k-2}{k-1}}{\binom{2k-2}{k-1}}.$$

For $$q=-1$$ analogous results hold for $$d_{k}(2n,-1).$$ Here we get $$\frac{d_{2k}(2n,-1)}{d_{2k-1}(2n,-1)}=\frac{\binom{2n+2k-2}{k-1}}{\binom{2k-2}{k-1}}$$ and $$\frac{d_{2k+1}(2n,-1)}{d_{2k}(2n,-1)}=\frac{\binom{2n+2k}{k}}{\binom{2k}{k}}.$$

So my question is: Let $$\zeta_{m}$$ be an $$m-$$th root of unity. Are there analogous results for $$\frac{d_{mk+j}(mn, \zeta_{m})}{d_{mk+j-1}(mn, \zeta_{m})}?$$

Computations suggest that this is true for $$m=4.$$ Here we get $$\frac{d_{4k+j}(4n,i)}{d_{4k+j-1}(4n,i)}=\frac{\binom{2n+2k}{k}}{\binom{2k}{k}}$$ for $$j=1,2,3$$ and $$\frac{d_{4k}(4n,i)}{d_{4kj-1}(4n,i)}=\frac{\binom{2n+2k-1}{k}}{\binom{2k-1}{k}}.$$

For $$m=3$$ we get $$\frac{d_{3k+j}(3n,\rho)}{d_{3k+j-1}(3n,\rho)}=\frac{\binom{2n+2k}{k}}{\binom{2k}{k}}$$ for $$j=1,2.$$ But I could not find a formula for $$\frac{d_{3k}(3n,\rho)}{d_{3k-1}(3n,\rho)}$$.

I would be interested how to prove these conjectures and if there are analogous results for general $$m.$$

• I don't have my library here: is there a product formula for $q=1$? Jan 6, 2022 at 19:59
• @MartinRubey: for the $q=1$ case see mathoverflow.net/questions/402767/…. Jan 6, 2022 at 21:29
• For $m=3$ and $j=0$ the numbers are not rational, right? Jan 7, 2022 at 15:53
• @MartinRubey: yes, $\frac{d_{3}(3n,\rho)}{d_{2}(3n,\rho)}=n\frac{1+\sqrt{-3}}{2}+1$ Jan 7, 2022 at 16:38

This is more of an extended comment. It is in fact possible to guess formulas for larger $$k$$ using the FriCAS guessing package.

At least for $$k=3$$ I obtain something reasonable: $$q^{\frac{n(n-1)(4n+13)}{6}} \frac{(q^{n+3}+q^{n+1}-q-1)(q^{n+2}-1)(q^{n+1}-1)} {(q;q)_3}$$

The trick is to remove the power of $$q$$ first. Explicitly (I used FriCAS from within Sage, which makes things only slightly more complicated), I first define a few helpers:

R.<q> = QQ[]

@cached_function
def q_catalan(n):
if n == 0:
return 1
return sum(q_catalan(j)*q_catalan(n-1-j)*q^j for j in range(n))

@cached_function
def hankel(k, n):
return det(matrix([[q_catalan(i+j+k) for i in range(n)] for j in range(n)]))

def get_q_power(poly):
for f, e in poly.factor():
if f == q:
return e
return 0


Then, we find:

sage: e = [get_q_power(hankel(3, n)) for n in range(10)]; e
[0, 0, 7, 25, 58, 110, 185, 287, 420, 588]
sage: fricas.guessRat(e)[0].sage().factor()
1/6*(4*n + 13)*(n - 1)*n
sage: e = [get_q_power(hankel(4, n)) for n in range(10)]; e
[0, 0, 9, 31, 70, 130, 215, 329, 476, 660]
sage: fricas.guessRat(e)[0].sage().factor()
1/6*(4*n + 19)*(n - 1)*n


from which we guess that we should take out a factor $q^{\frac{n(n-1)(4n+6k-5)}{6}}$:

sage: hankel_reduced = lambda k, n: hankel(k, n)/q^(n*(n-1)*(4*n+6*k-5)/6)
sage: k=3; fricas.guessRat(q)([hankel_reduced(k, n) for n in range(10)], [])
6    4  3 n       5      4      3    2  2 n       3      2        n
(q  + q )q    + (- q  - 2 q  - 2 q  - q )q    + (2 q  + 2 q  + 2 q)q  - q - 1
[-----------------------------------------------------------------------------]
6    5    4    2
q  - q  - q  + q  + q - 1
sage: k=4; fricas.guessRat(q)([hankel_reduced(k, n) for n in range(10)], [])
[
18    16    15      14    13    12    10  6 n
(q   + q   + q   + 2 q   + q   + q   + q  )q
+
17      16      15      14      13      12      11      10      9
- q   - 2 q   - 4 q   - 5 q   - 8 q   - 8 q   - 8 q   - 5 q   - 4 q
+
8    7
- 2 q  - q
*
5 n
q
+
15      14       13       12       11       10       9       8
2 q   + 4 q   + 10 q   + 14 q   + 20 q   + 20 q   + 20 q  + 14 q
+
7      6      5
10 q  + 4 q  + 2 q
*
4 n
q
+
13      12       11       10       9       8       7       6
- q   - 6 q   - 11 q   - 21 q   - 26 q  - 30 q  - 26 q  - 21 q
+
5      4    3
- 11 q  - 6 q  - q
*
3 n
q
+
10      9       8       7       6       5       4      3      2  2 n
(3 q   + 8 q  + 16 q  + 21 q  + 24 q  + 21 q  + 16 q  + 8 q  + 3 q )q
+
7      6       5       4       3      2        n    4      3      2
(- 3 q  - 6 q  - 10 q  - 10 q  - 10 q  - 6 q  - 3 q)q  + q  + 2 q  + 2 q
+
2 q + 1
/
18    17    16    15    14      13    12    11      10      9      8    7
q   - q   - q   - q   + q   + 2 q   + q   + q   - 2 q   - 2 q  - 2 q  + q
+
6      5    4    3    2
q  + 2 q  + q  - q  - q  - q + 1
]



This indicates that we are actually expecting a $q$-polynomial (not a $q$-fraction) of $q$-degree $\binom{k}{2}$, which tells us the exact number of terms we need to provide to guess the polynomials. Next I tried to guess the denominator polynomials:

sage: [fricas.guessRat(q)([hankel_reduced(k, n) for n in range(binomial(k, 2)+2)], [])[0].sage().denominator().factor() for k in range(1, 7)]
[1,
q - 1,
(q^2 + q + 1)*(q + 1)*(q - 1)^3,
(q^4 + q^3 + q^2 + q + 1)*(q^2 + q + 1)^2*(q^2 + 1)*(q + 1)^2*(q - 1)^6,
(q^6 + q^5 + q^4 + q^3 + q^2 + q + 1)*(q^4 + q^3 + q^2 + q + 1)^2*(q^2 + q + 1)^3*(q^2 - q + 1)*(q^2 + 1)^2*(q + 1)^4*(q - 1)^10,
(q + 1)^6 * (q - 1)^15 * (q^2 - q + 1)^2 * (q^2 + 1)^3 * (q^2 + q + 1)^5 * (q^4 + 1) * (q^4 + q^3 + q^2 + q + 1)^3 * (q^6 + q^3 + 1) * (q^6 + q^5 + q^4 + q^3 + q^2 + q + 1)^2]


Taking out the factor $$(q-1)^{\binom{k}{2}}$$ and plugging in $$q=1$$, we obtain https://oeis.org/A086205, which has an obvious $$q$$-analogue, so we obtain $$(q-1)^{\binom{k}{2}}\prod_{i=1}^{k-1}\frac{[2i-1]!}{[i-1]!}$$ for the denominator.

Apparently, the numerator is not quite as easy to guess. However, it appears that $$\prod_{i=1}^{k-1} (q^{n+i}-1)^{\min(i,k-i)}$$ is a factor. This allows us to guess more terms, since the degree of what remains is just $$\lfloor\frac{(k-1)^2}{4}\rfloor$$. The first few, beginning with $$k=2$$, are

[1,
q^(n + 3) + q^(n + 1) - q - 1,
q^4 + 2*q^3 + 2*q^2 + 2*q + q^(2*n + 10) + q^(2*n + 8) + q^(2*n + 7) + 2*q^(2*n + 6) + q^(2*n + 5) + q^(2*n + 4) + q^(2*n + 2) - 2*q^(n + 7) - 2*q^(n + 6) - 3*q^(n + 5) - 2*q^(n + 4) - 3*q^(n + 3) - 2*q^(n + 2) - 2*q^(n + 1) + 1,
q^10 + 3*q^9 + 5*q^8 + 8*q^7 + 10*q^6 + 10*q^5 + 10*q^4 + 8*q^3 + 5*q^2 + q^(4*n + 25) + q^(4*n + 23) + q^(4*n + 22) + 3*q^(4*n + 21) + 2*q^(4*n + 20) + 5*q^(4*n + 19) + 4*q^(4*n + 18) + 7*q^(4*n + 17) + 5*q^(4*n + 16) + 6*q^(4*n + 15) + 5*q^(4*n + 14) + 7*q^(4*n + 13) + 4*q^(4*n + 12) + 5*q^(4*n + 11) + 2*q^(4*n + 10) + 3*q^(4*n + 9) + q^(4*n + 8) + q^(4*n + 7) + q^(4*n + 5) - q^(3*n + 22) - 3*q^(3*n + 21) - 4*q^(3*n + 20) - 6*q^(3*n + 19) - 10*q^(3*n + 18) - 14*q^(3*n + 17) - 18*q^(3*n + 16) - 21*q^(3*n + 15) - 24*q^(3*n + 14) - 27*q^(3*n + 13) - 27*q^(3*n + 12) - 24*q^(3*n + 11) - 21*q^(3*n + 10) - 18*q^(3*n + 9) - 14*q^(3*n + 8) - 10*q^(3*n + 7) - 6*q^(3*n + 6) - 4*q^(3*n + 5) - 3*q^(3*n + 4) - q^(3*n + 3) + 3*q^(2*n + 18) + 6*q^(2*n + 17) + 12*q^(2*n + 16) + 16*q^(2*n + 15) + 24*q^(2*n + 14) + 30*q^(2*n + 13) + 39*q^(2*n + 12) + 40*q^(2*n + 11) + 44*q^(2*n + 10) + 40*q^(2*n + 9) + 39*q^(2*n + 8) + 30*q^(2*n + 7) + 24*q^(2*n + 6) + 16*q^(2*n + 5) + 12*q^(2*n + 4) + 6*q^(2*n + 3) + 3*q^(2*n + 2) + 3*q - 3*q^(n + 14) - 7*q^(n + 13) - 13*q^(n + 12) - 19*q^(n + 11) - 25*q^(n + 10) - 29*q^(n + 9) - 32*q^(n + 8) - 32*q^(n + 7) - 29*q^(n + 6) - 25*q^(n + 5) - 19*q^(n + 4) - 13*q^(n + 3) - 7*q^(n + 2) - 3*q^(n + 1) + 1,
q^20 + 4*q^19 + 9*q^18 + 18*q^17 + 31*q^16 + 46*q^15 + 64*q^14 + 82*q^13 + 96*q^12 + 106*q^11 + 110*q^10 + 106*q^9 + 96*q^8 + 82*q^7 + 64*q^6 + 46*q^5 + 31*q^4 + 18*q^3 + 9*q^2 + q^(6*n + 48) + q^(6*n + 46) + q^(6*n + 45) + 3*q^(6*n + 44) + 3*q^(6*n + 43) + 6*q^(6*n + 42) + 6*q^(6*n + 41) + 12*q^(6*n + 40) + 13*q^(6*n + 39) + 20*q^(6*n + 38) + 23*q^(6*n + 37) + 32*q^(6*n + 36) + 33*q^(6*n + 35) + 43*q^(6*n + 34) + 44*q^(6*n + 33) + 4*q + 56*q^(6*n + 32) + 56*q^(6*n + 31) + 64*q^(6*n + 30) + 61*q^(6*n + 29) + 68*q^(6*n + 28) + 61*q^(6*n + 27) + 64*q^(6*n + 26) + 56*q^(6*n + 25) + 56*q^(6*n + 24) + 44*q^(6*n + 23) + 43*q^(6*n + 22) + 33*q^(6*n + 21) + 32*q^(6*n + 20) + 23*q^(6*n + 19) + 20*q^(6*n + 18) + 13*q^(6*n + 17) + 12*q^(6*n + 16) + 6*q^(6*n + 15) + 6*q^(6*n + 14) + 3*q^(6*n + 13) + 3*q^(6*n + 12) + q^(6*n + 11) + q^(6*n + 10) + q^(6*n + 8) - 2*q^(5*n + 44) - 4*q^(5*n + 43) - 6*q^(5*n + 42) - 9*q^(5*n + 41) - 16*q^(5*n + 40) - 26*q^(5*n + 39) - 39*q^(5*n + 38) - 56*q^(5*n + 37) - 78*q^(5*n + 36) - 105*q^(5*n + 35) - 135*q^(5*n + 34) - 171*q^(5*n + 33) - 212*q^(5*n + 32) - 254*q^(5*n + 31) - 292*q^(5*n + 30) - 326*q^(5*n + 29) - 357*q^(5*n + 28) - 383*q^(5*n + 27) - 399*q^(5*n + 26) - 404*q^(5*n + 25) - 399*q^(5*n + 24) - 383*q^(5*n + 23) - 357*q^(5*n + 22) - 326*q^(5*n + 21) - 292*q^(5*n + 20) - 254*q^(5*n + 19) - 212*q^(5*n + 18) - 171*q^(5*n + 17) - 135*q^(5*n + 16) - 105*q^(5*n + 15) - 78*q^(5*n + 14) - 56*q^(5*n + 13) - 39*q^(5*n + 12) - 26*q^(5*n + 11) - 16*q^(5*n + 10) - 9*q^(5*n + 9) - 6*q^(5*n + 8) - 4*q^(5*n + 7) - 2*q^(5*n + 6) + q^(4*n + 40) + 8*q^(4*n + 39) + 15*q^(4*n + 38) + 29*q^(4*n + 37) + 45*q^(4*n + 36) + 77*q^(4*n + 35) + 113*q^(4*n + 34) + 172*q^(4*n + 33) + 234*q^(4*n + 32) + 325*q^(4*n + 31) + 412*q^(4*n + 30) + 523*q^(4*n + 29) + 623*q^(4*n + 28) + 745*q^(4*n + 27) + 841*q^(4*n + 26) + 942*q^(4*n + 25) + 997*q^(4*n + 24) + 1051*q^(4*n + 23) + 1054*q^(4*n + 22) + 1051*q^(4*n + 21) + 997*q^(4*n + 20) + 942*q^(4*n + 19) + 841*q^(4*n + 18) + 745*q^(4*n + 17) + 623*q^(4*n + 16) + 523*q^(4*n + 15) + 412*q^(4*n + 14) + 325*q^(4*n + 13) + 234*q^(4*n + 12) + 172*q^(4*n + 11) + 113*q^(4*n + 10) + 77*q^(4*n + 9) + 45*q^(4*n + 8) + 29*q^(4*n + 7) + 15*q^(4*n + 6) + 8*q^(4*n + 5) + q^(4*n + 4) - 4*q^(3*n + 35) - 16*q^(3*n + 34) - 37*q^(3*n + 33) - 68*q^(3*n + 32) - 116*q^(3*n + 31) - 182*q^(3*n + 30) - 271*q^(3*n + 29) - 383*q^(3*n + 28) - 518*q^(3*n + 27) - 673*q^(3*n + 26) - 841*q^(3*n + 25) - 1007*q^(3*n + 24) - 1163*q^(3*n + 23) - 1305*q^(3*n + 22) - 1415*q^(3*n + 21) - 1486*q^(3*n + 20) - 1510*q^(3*n + 19) - 1486*q^(3*n + 18) - 1415*q^(3*n + 17) - 1305*q^(3*n + 16) - 1163*q^(3*n + 15) - 1007*q^(3*n + 14) - 841*q^(3*n + 13) - 673*q^(3*n + 12) - 518*q^(3*n + 11) - 383*q^(3*n + 10) - 271*q^(3*n + 9) - 182*q^(3*n + 8) - 116*q^(3*n + 7) - 68*q^(3*n + 6) - 37*q^(3*n + 5) - 16*q^(3*n + 4) - 4*q^(3*n + 3) + 6*q^(2*n + 30) + 20*q^(2*n + 29) + 49*q^(2*n + 28) + 91*q^(2*n + 27) + 157*q^(2*n + 26) + 240*q^(2*n + 25) + 351*q^(2*n + 24) + 473*q^(2*n + 23) + 619*q^(2*n + 22) + 762*q^(2*n + 21) + 914*q^(2*n + 20) + 1036*q^(2*n + 19) + 1144*q^(2*n + 18) + 1202*q^(2*n + 17) + 1232*q^(2*n + 16) + 1202*q^(2*n + 15) + 1144*q^(2*n + 14) + 1036*q^(2*n + 13) + 914*q^(2*n + 12) + 762*q^(2*n + 11) + 619*q^(2*n + 10) + 473*q^(2*n + 9) + 351*q^(2*n + 8) + 240*q^(2*n + 7) + 157*q^(2*n + 6) + 91*q^(2*n + 5) + 49*q^(2*n + 4) + 20*q^(2*n + 3) + 6*q^(2*n + 2) - 4*q^(n + 25) - 14*q^(n + 24) - 33*q^(n + 23) - 64*q^(n + 22) - 109*q^(n + 21) - 166*q^(n + 20) - 234*q^(n + 19) - 308*q^(n + 18) - 381*q^(n + 17) - 448*q^(n + 16) - 501*q^(n + 15) - 536*q^(n + 14) - 548*q^(n + 13) - 536*q^(n + 12) - 501*q^(n + 11) - 448*q^(n + 10) - 381*q^(n + 9) - 308*q^(n + 8) - 234*q^(n + 7) - 166*q^(n + 6) - 109*q^(n + 5) - 64*q^(n + 4) - 33*q^(n + 3) - 14*q^(n + 2) - 4*q^(n + 1) + 1,
-q^35 - 5*q^34 - 14*q^33 - 33*q^32 - 68*q^31 - 124*q^30 - 210*q^29 - 332*q^28 - 492*q^27 - 693*q^26 - 931*q^25 - 1196*q^24 - 1476*q^23 - 1754*q^22 - 2008*q^21 - 2220*q^20 - 2374*q^19 - 2453*q^18 - 2453*q^17 - 2374*q^16 - 2220*q^15 - 2008*q^14 - 1754*q^13 - 1476*q^12 - 1196*q^11 - 931*q^10 - 693*q^9 - 492*q^8 - 332*q^7 - 210*q^6 - 124*q^5 - 68*q^4 - 33*q^3 - 14*q^2 + q^(9*n + 84) + q^(9*n + 82) + q^(9*n + 81) + 3*q^(9*n + 80) + 3*q^(9*n + 79) + 7*q^(9*n + 78) + 7*q^(9*n + 77) + 14*q^(9*n + 76) + 16*q^(9*n + 75) + 28*q^(9*n + 74) + 33*q^(9*n + 73) + 53*q^(9*n + 72) + 63*q^(9*n + 71) + 94*q^(9*n + 70) + 113*q^(9*n + 69) + 157*q^(9*n + 68) + 187*q^(9*n + 67) + 247*q^(9*n + 66) + 288*q^(9*n + 65) + 368*q^(9*n + 64) + 424*q^(9*n + 63) + 523*q^(9*n + 62) + 591*q^(9*n + 61) + 704*q^(9*n + 60) + 776*q^(9*n + 59) + 900*q^(9*n + 58) + 972*q^(9*n + 57) + 1095*q^(9*n + 56) + 1158*q^(9*n + 55) + 1267*q^(9*n + 54) + 1307*q^(9*n + 53) + 1395*q^(9*n + 52) + 1405*q^(9*n + 51) + 1463*q^(9*n + 50) + 1440*q^(9*n + 49) + 1463*q^(9*n + 48) + 1405*q^(9*n + 47) + 1395*q^(9*n + 46) + 1307*q^(9*n + 45) + 1267*q^(9*n + 44) + 1158*q^(9*n + 43) + 1095*q^(9*n + 42) + 972*q^(9*n + 41) + 900*q^(9*n + 40) + 776*q^(9*n + 39) + 704*q^(9*n + 38) + 591*q^(9*n + 37) + 523*q^(9*n + 36) + 424*q^(9*n + 35) + 368*q^(9*n + 34) + 288*q^(9*n + 33) + 247*q^(9*n + 32) + 187*q^(9*n + 31) + 157*q^(9*n + 30) + 113*q^(9*n + 29) + 94*q^(9*n + 28) + 63*q^(9*n + 27) + 53*q^(9*n + 26) + 33*q^(9*n + 25) + 28*q^(9*n + 24) + 16*q^(9*n + 23) + 14*q^(9*n + 22) + 7*q^(9*n + 21) + 7*q^(9*n + 20) + 3*q^(9*n + 19) + 3*q^(9*n + 18) + q^(9*n + 17) + q^(9*n + 16) + q^(9*n + 14) - q^(8*n + 80) - 3*q^(8*n + 79) - 5*q - 6*q^(8*n + 78) - 9*q^(8*n + 77) - 15*q^(8*n + 76) - 25*q^(8*n + 75) - 42*q^(8*n + 74) - 66*q^(8*n + 73) - 100*q^(8*n + 72) - 148*q^(8*n + 71) - 217*q^(8*n + 70) - 309*q^(8*n + 69) - 433*q^(8*n + 68) - 595*q^(8*n + 67) - 803*q^(8*n + 66) - 1063*q^(8*n + 65) - 1385*q^(8*n + 64) - 1777*q^(8*n + 63) - 2246*q^(8*n + 62) - 2789*q^(8*n + 61) - 3409*q^(8*n + 60) - 4105*q^(8*n + 59) - 4877*q^(8*n + 58) - 5714*q^(8*n + 57) - 6605*q^(8*n + 56) - 7529*q^(8*n + 55) - 8466*q^(8*n + 54) - 9387*q^(8*n + 53) - 10272*q^(8*n + 52) - 11096*q^(8*n + 51) - 11835*q^(8*n + 50) - 12458*q^(8*n + 49) - 12944*q^(8*n + 48) - 13278*q^(8*n + 47) - 13449*q^(8*n + 46) - 13449*q^(8*n + 45) - 13278*q^(8*n + 44) - 12944*q^(8*n + 43) - 12458*q^(8*n + 42) - 11835*q^(8*n + 41) - 11096*q^(8*n + 40) - 10272*q^(8*n + 39) - 9387*q^(8*n + 38) - 8466*q^(8*n + 37) - 7529*q^(8*n + 36) - 6605*q^(8*n + 35) - 5714*q^(8*n + 34) - 4877*q^(8*n + 33) - 4105*q^(8*n + 32) - 3409*q^(8*n + 31) - 2789*q^(8*n + 30) - 2246*q^(8*n + 29) - 1777*q^(8*n + 28) - 1385*q^(8*n + 27) - 1063*q^(8*n + 26) - 803*q^(8*n + 25) - 595*q^(8*n + 24) - 433*q^(8*n + 23) - 309*q^(8*n + 22) - 217*q^(8*n + 21) - 148*q^(8*n + 20) - 100*q^(8*n + 19) - 66*q^(8*n + 18) - 42*q^(8*n + 17) - 25*q^(8*n + 16) - 15*q^(8*n + 15) - 9*q^(8*n + 14) - 6*q^(8*n + 13) - 3*q^(8*n + 12) - q^(8*n + 11) + 3*q^(7*n + 75) + 8*q^(7*n + 74) + 23*q^(7*n + 73) + 40*q^(7*n + 72) + 75*q^(7*n + 71) + 121*q^(7*n + 70) + 210*q^(7*n + 69) + 327*q^(7*n + 68) + 520*q^(7*n + 67) + 769*q^(7*n + 66) + 1147*q^(7*n + 65) + 1623*q^(7*n + 64) + 2300*q^(7*n + 63) + 3131*q^(7*n + 62) + 4250*q^(7*n + 61) + 5573*q^(7*n + 60) + 7263*q^(7*n + 59) + 9201*q^(7*n + 58) + 11578*q^(7*n + 57) + 14210*q^(7*n + 56) + 17289*q^(7*n + 55) + 20562*q^(7*n + 54) + 24230*q^(7*n + 53) + 27969*q^(7*n + 52) + 31982*q^(7*n + 51) + 35877*q^(7*n + 50) + 39864*q^(7*n + 49) + 43481*q^(7*n + 48) + 46959*q^(7*n + 47) + 49820*q^(7*n + 46) + 52343*q^(7*n + 45) + 54049*q^(7*n + 44) + 55260*q^(7*n + 43) + 55534*q^(7*n + 42) + 55260*q^(7*n + 41) + 54049*q^(7*n + 40) + 52343*q^(7*n + 39) + 49820*q^(7*n + 38) + 46959*q^(7*n + 37) + 43481*q^(7*n + 36) + 39864*q^(7*n + 35) + 35877*q^(7*n + 34) + 31982*q^(7*n + 33) + 27969*q^(7*n + 32) + 24230*q^(7*n + 31) + 20562*q^(7*n + 30) + 203662*q^(5*n + 37) + 94662*q^(5*n + 25) + 17289*q^(7*n + 29) + 14210*q^(7*n + 28) + 11578*q^(7*n + 27) + 9201*q^(7*n + 26) + 7263*q^(7*n + 25) + 5573*q^(7*n + 24) + 4250*q^(7*n + 23) + 3131*q^(7*n + 22) + 2300*q^(7*n + 21) + 1623*q^(7*n + 20) + 1147*q^(7*n + 19) + 769*q^(7*n + 18) + 520*q^(7*n + 17) + 327*q^(7*n + 16) + 210*q^(7*n + 15) + 121*q^(7*n + 14) + 75*q^(7*n + 13) + 40*q^(7*n + 12) + 23*q^(7*n + 11) + 8*q^(7*n + 10) + 3*q^(7*n + 9) - 3*q^(6*n + 70) - 16*q^(6*n + 69) - 43*q^(6*n + 68) - 99*q^(6*n + 67) - 191*q^(6*n + 66) - 344*q^(6*n + 65) - 587*q^(6*n + 64) - 965*q^(6*n + 63) - 1521*q^(6*n + 62) - 2330*q^(6*n + 61) - 3452*q^(6*n + 60) - 4981*q^(6*n + 59) - 6999*q^(6*n + 58) - 9618*q^(6*n + 57) - 12922*q^(6*n + 56) - 17016*q^(6*n + 55) - 21946*q^(6*n + 54) - 27776*q^(6*n + 53) - 34511*q^(6*n + 52) - 42139*q^(6*n + 51) - 50573*q^(6*n + 50) - 59706*q^(6*n + 49) - 69338*q^(6*n + 48) - 79259*q^(6*n + 47) - 89190*q^(6*n + 46) - 98845*q^(6*n + 45) - 107908*q^(6*n + 44) - 116073*q^(6*n + 43) - 123015*q^(6*n + 42) - 128478*q^(6*n + 41) - 132246*q^(6*n + 40) - 134166*q^(6*n + 39) - 134166*q^(6*n + 38) - 132246*q^(6*n + 37) - 128478*q^(6*n + 36) - 123015*q^(6*n + 35) - 116073*q^(6*n + 34) - 107908*q^(6*n + 33) - 98845*q^(6*n + 32) - 89190*q^(6*n + 31) - 79259*q^(6*n + 30) - 69338*q^(6*n + 29) - 59706*q^(6*n + 28) - 50573*q^(6*n + 27) - 42139*q^(6*n + 26) - 34511*q^(6*n + 25) - 27776*q^(6*n + 24) - 21946*q^(6*n + 23) - 17016*q^(6*n + 22) - 12922*q^(6*n + 21) - 9618*q^(6*n + 20) - 6999*q^(6*n + 19) - 4981*q^(6*n + 18) - 3452*q^(6*n + 17) - 2330*q^(6*n + 16) - 1521*q^(6*n + 15) - 965*q^(6*n + 14) - 587*q^(6*n + 13) - 344*q^(6*n + 12) - 191*q^(6*n + 11) - 99*q^(6*n + 10) - 43*q^(6*n + 9) - 16*q^(6*n + 8) - 3*q^(6*n + 7) + q^(5*n + 65) + 15*q^(5*n + 64) + 51*q^(5*n + 63) + 139*q^(5*n + 62) + 296*q^(5*n + 61) + 583*q^(5*n + 60) + 1036*q^(5*n + 59) + 1768*q^(5*n + 58) + 2840*q^(5*n + 57) + 4435*q^(5*n + 56) + 6634*q^(5*n + 55) + 9676*q^(5*n + 54) + 13636*q^(5*n + 53) + 18800*q^(5*n + 52) + 25198*q^(5*n + 51) + 33117*q^(5*n + 50) + 42470*q^(5*n + 49) + 53479*q^(5*n + 48) + 65875*q^(5*n + 47) + 79768*q^(5*n + 46) + 94662*q^(5*n + 45) + 110535*q^(5*n + 44) + 126661*q^(5*n + 43) + 142893*q^(5*n + 42) + 158337*q^(5*n + 41) + 172812*q^(5*n + 40) + 185382*q^(5*n + 39) + 195950*q^(5*n + 38) + 208606*q^(5*n + 36) + 210134*q^(5*n + 35) + 208606*q^(5*n + 34) + 203662*q^(5*n + 33) + 195950*q^(5*n + 32) + 185382*q^(5*n + 31) + 172812*q^(5*n + 30) + 158337*q^(5*n + 29) + 142893*q^(5*n + 28) + 126661*q^(5*n + 27) + 110535*q^(5*n + 26) + 79768*q^(5*n + 24) + 65875*q^(5*n + 23) + 53479*q^(5*n + 22) + 42470*q^(5*n + 21) + 33117*q^(5*n + 20) + 25198*q^(5*n + 19) + 18800*q^(5*n + 18) + 13636*q^(5*n + 17) + 9676*q^(5*n + 16) + 6634*q^(5*n + 15) + 4435*q^(5*n + 14) + 2840*q^(5*n + 13) + 1768*q^(5*n + 12) + 1036*q^(5*n + 11) + 583*q^(5*n + 10) + 296*q^(5*n + 9) + 139*q^(5*n + 8) + 51*q^(5*n + 7) + 15*q^(5*n + 6) + q^(5*n + 5) - 5*q^(4*n + 59) - 35*q^(4*n + 58) - 112*q^(4*n + 57) - 285*q^(4*n + 56) - 606*q^(4*n + 55) - 1168*q^(4*n + 54) - 2070*q^(4*n + 53) - 3465*q^(4*n + 52) - 5505*q^(4*n + 51) - 8404*q^(4*n + 50) - 12355*q^(4*n + 49) - 17592*q^(4*n + 48) - 24287*q^(4*n + 47) - 32639*q^(4*n + 46) - 42738*q^(4*n + 45) - 54657*q^(4*n + 44) - 68311*q^(4*n + 43) - 83570*q^(4*n + 42) - 100125*q^(4*n + 41) - 117609*q^(4*n + 40) - 135488*q^(4*n + 39) - 153203*q^(4*n + 38) - 170082*q^(4*n + 37) - 185475*q^(4*n + 36) - 198706*q^(4*n + 35) - 209203*q^(4*n + 34) - 216480*q^(4*n + 33) - 220209*q^(4*n + 32) - 220209*q^(4*n + 31) - 216480*q^(4*n + 30) - 209203*q^(4*n + 29) - 198706*q^(4*n + 28) - 185475*q^(4*n + 27) - 170082*q^(4*n + 26) - 153203*q^(4*n + 25) - 135488*q^(4*n + 24) - 117609*q^(4*n + 23) - 100125*q^(4*n + 22) - 83570*q^(4*n + 21) - 68311*q^(4*n + 20) - 54657*q^(4*n + 19) - 42738*q^(4*n + 18) - 32639*q^(4*n + 17) - 24287*q^(4*n + 16) - 17592*q^(4*n + 15) - 12355*q^(4*n + 14) - 8404*q^(4*n + 13) - 5505*q^(4*n + 12) - 3465*q^(4*n + 11) - 2070*q^(4*n + 10) - 1168*q^(4*n + 9) - 606*q^(4*n + 8) - 285*q^(4*n + 7) - 112*q^(4*n + 6) - 35*q^(4*n + 5) - 5*q^(4*n + 4) + 10*q^(3*n + 53) + 50*q^(3*n + 52) + 159*q^(3*n + 51) + 384*q^(3*n + 50) + 814*q^(3*n + 49) + 1538*q^(3*n + 48) + 2704*q^(3*n + 47) + 4445*q^(3*n + 46) + 6956*q^(3*n + 45) + 10391*q^(3*n + 44) + 14973*q^(3*n + 43) + 20800*q^(3*n + 42) + 28042*q^(3*n + 41) + 36688*q^(3*n + 40) + 46779*q^(3*n + 39) + 58103*q^(3*n + 38) + 70527*q^(3*n + 37) + 83608*q^(3*n + 36) + 97042*q^(3*n + 35) + 110202*q^(3*n + 34) + 122671*q^(3*n + 33) + 133762*q^(3*n + 32) + 143106*q^(3*n + 31) + 150074*q^(3*n + 30) + 154473*q^(3*n + 29) + 155910*q^(3*n + 28) + 154473*q^(3*n + 27) + 150074*q^(3*n + 26) + 143106*q^(3*n + 25) + 133762*q^(3*n + 24) + 122671*q^(3*n + 23) + 110202*q^(3*n + 22) + 97042*q^(3*n + 21) + 83608*q^(3*n + 20) + 70527*q^(3*n + 19) + 58103*q^(3*n + 18) + 46779*q^(3*n + 17) + 36688*q^(3*n + 16) + 28042*q^(3*n + 15) + 20800*q^(3*n + 14) + 14973*q^(3*n + 13) + 10391*q^(3*n + 12) + 6956*q^(3*n + 11) + 4445*q^(3*n + 10) + 2704*q^(3*n + 9) + 1538*q^(3*n + 8) + 814*q^(3*n + 7) + 384*q^(3*n + 6) + 159*q^(3*n + 5) + 50*q^(3*n + 4) + 10*q^(3*n + 3) - 10*q^(2*n + 47) - 45*q^(2*n + 46) - 138*q^(2*n + 45) - 328*q^(2*n + 44) - 684*q^(2*n + 43) - 1279*q^(2*n + 42) - 2218*q^(2*n + 41) - 3592*q^(2*n + 40) - 5519*q^(2*n + 39) - 8085*q^(2*n + 38) - 11381*q^(2*n + 37) - 15429*q^(2*n + 36) - 20242*q^(2*n + 35) - 25743*q^(2*n + 34) - 31827*q^(2*n + 33) - 38291*q^(2*n + 32) - 44912*q^(2*n + 31) - 51395*q^(2*n + 30) - 57447*q^(2*n + 29) - 62741*q^(2*n + 28) - 67003*q^(2*n + 27) - 69987*q^(2*n + 26) - 71528*q^(2*n + 25) - 71528*q^(2*n + 24) - 69987*q^(2*n + 23) - 67003*q^(2*n + 22) - 62741*q^(2*n + 21) - 57447*q^(2*n + 20) - 51395*q^(2*n + 19) - 44912*q^(2*n + 18) - 38291*q^(2*n + 17) - 31827*q^(2*n + 16) - 25743*q^(2*n + 15) - 20242*q^(2*n + 14) - 15429*q^(2*n + 13) - 11381*q^(2*n + 12) - 8085*q^(2*n + 11) - 5519*q^(2*n + 10) - 3592*q^(2*n + 9) - 2218*q^(2*n + 8) - 1279*q^(2*n + 7) - 684*q^(2*n + 6) - 328*q^(2*n + 5) - 138*q^(2*n + 4) - 45*q^(2*n + 3) - 10*q^(2*n + 2) + 5*q^(n + 41) + 23*q^(n + 40) + 67*q^(n + 39) + 159*q^(n + 38) + 327*q^(n + 37) + 606*q^(n + 36) + 1036*q^(n + 35) + 1656*q^(n + 34) + 2499*q^(n + 33) + 3589*q^(n + 32) + 4933*q^(n + 31) + 6517*q^(n + 30) + 8302*q^(n + 29) + 10227*q^(n + 28) + 12207*q^(n + 27) + 14143*q^(n + 26) + 15928*q^(n + 25) + 17453*q^(n + 24) + 18621*q^(n + 23) + 19355*q^(n + 22) + 19606*q^(n + 21) + 19355*q^(n + 20) + 18621*q^(n + 19) + 17453*q^(n + 18) + 15928*q^(n + 17) + 14143*q^(n + 16) + 12207*q^(n + 15) + 10227*q^(n + 14) + 8302*q^(n + 13) + 6517*q^(n + 12) + 4933*q^(n + 11) + 3589*q^(n + 10) + 2499*q^(n + 9) + 1656*q^(n + 8) + 1036*q^(n + 7) + 606*q^(n + 6) + 327*q^(n + 5) + 159*q^(n + 4) + 67*q^(n + 3) + 23*q^(n + 2) + 5*q^(n + 1) - 1]


The constant term of these is easy to guess again, it is $$\prod_{j=1}^{k-2} (1+q^j)^{k-1-j}$$. The linear term also has some obvious factors, which are of somewhat similar form, but there is also a larger factor which I cannot explain.

• But in the end one just gets polynomials, right? I mean, all denominators cancel out. It looks mysterious already for the $k=3$ case: it is only apparent to me that $(q^{n+3}+q^{n+1}-q-1)(q^{n+1}-1)(q^{n+2}-1)$ is divisible by $(q-1)^2(q^2-1)$, but why does the remaining $q^2+q+1$ in the denominator also always cancel out? Jan 6, 2022 at 20:57
• It seems that the coefficient of $q^n$ in the final missing bit is a $q$-analogue of $2^{k-1}\lfloor\frac{(k-1)^2}{4}\rfloor$. But it does not factor, so it is probably a sum of terms. Jan 6, 2022 at 21:26
• In fact the result seems to be a product of cyclotomic polynomials times either $1+2q+2q^2+2q^3+...+2q^n+q^{n+1}+q^{n+2}$ (if $n$ is not divisible by 3) or $1+q+q^3+q^4+q^6+q^7+q^9+q^{10}+...+q^{n-2}+q^n$, if $n$ is divisible by 3. Jan 6, 2022 at 21:27
• @მამუკაჯიბლაძე This is for $k=3$, right? Jan 6, 2022 at 21:44
• Yes, only for this case. Btw, I am doing your code through sagemathcell and cannot get rid of the ascii art output, do you know how to force just plain text output? Jan 6, 2022 at 22:03