The number of the so-called [Baxter permutations of length $n$](https://en.wikipedia.org/wiki/Baxter_permutation) is computed by
$$a\_n=\frac1{\binom{n+1}1\binom{n+1}2}\sum\_{k=0}^{n-1}\binom{n+1}k\binom{n+1}{k+1}\binom{n+1}{k+2}.$$


There has also been a $q$-analogue of this sequence
$$a\_n(q)=\frac1{\binom{n+1}1\_q\binom{n+1}2\_q}\sum\_{k=0}^{n-1}q^{3\binom{k+1}2}
\binom{n+1}k\_q\binom{n+1}{k+1}\_q\binom{n+1}{k+2}\_q.$$
Hence $a\_n(1)=a\_n$.


Now, if we focus on the special values at $q=-1$ then it appears that the resulting sequence does seem to exhibit small prime factors, suggesting that one might be able to find a closed formula. Notice that such is not true when $q\neq-1$. Here are the first few values of $a\_n(-1)$ for $n\geq1$: $1, 0, 0, -2, -4, 0, 0, 18, 42, 0, 0, -240, -600, 0, 0, 3850, 10010, 0, 0, -68796,\dots$.


So, I like to ask:



> 
> **QUESTION.** Is there a nice formula for $a\_n(-1)$? Of course, one may restrict to the non-zero values.
> 
> 
> 



Closed formula for $(-1)$-Baxter sequences
Note that $-1$ is a root of the polynomial $q\to {n\choose k}\_q$ of multiplicity
$$\lfloor n/2\rfloor-\lfloor k/2\rfloor-\lfloor (n-k)/2\rfloor=\begin{cases}1,&\text{if}\,\,n\,\,\text{is even and}\,\,k\,\,\text{is odd}\\
0,&\text{otherwise}.\end{cases}$$
Thus ${n+1\choose 2}\_{-1}$ is always non-zero, and ${n+1\choose 1}\_{-1}$ is 0 when $n$ is odd. But in the latter case the ratio
$$h(n,k):=\frac{{n+1\choose k}\_q {n+1\choose k+1}\_q{n+1\choose k+2}\_q}
{{n+1\choose 1}\_q{n+1\choose 2}\_q}\,\,\,\text{at}\,\,\,q=-1
$$
is well-defined, since at least one of the numbers $k,k+1$, $k+2$ is odd. Moreover, if $n$ and $k$ are both odd, then we get $h(n,k)=0$: the multiplicity of $q=-1$ as a root of ${n+1\choose k}\_q {n+1\choose k+1}\_q{n+1\choose k+2}\_q$ equals 2 in this case, while for ${n+1\choose 1}\_q {n+1\choose 2}\_q$ $q=-1$ is a simple root. Next, we have $h(n,k)=h(n,n-k-1)$ (this holds not only at $q=-1$, but for corresponding rational functions in $q$). Thus
$$
a\_n(-1)=\sum\_{k=0}^{n-1}h(n,k)(-1)^{k(k+1)/2}=
\sum\_{k=0}^{n-1}h(n,n-k-1)(-1)^{(n-k-1)(n-k)/2}\\
=\sum\_{k=0}^{n-1}h(n,k)(-1)^{n(n-1)/2+k(k+1)/2-nk}.
$$


* If $n=4s+2$, then $n(n-1)/2+k(k+1)/2-nk$ and $k(k+1)/2$ always have different parity, so we get $a\_n(-1)=-a\_n(-1)$ and thus $a\_n(-1)=0$.
* If $n=4s+3$, then for even $k$ the exponents $n(n-1)/2+k(k+1)/2-nk$ and $k(k+1)/2$ have different parity, while for odd $k$ we have $h(n,k)=0$. Thus in this case we also get $a\_n(-1)=-a\_n(-1)=0$.
* Let $n=4s$. Then the exponents $n(n-1)/2+k(k+1)/2-nk$ and $k(k+1)/2$ have the same parity, thus the terms in the sum for $a\_n(-1)$ which correspond to $k$ and to $n-k-1$ are equal. Since exactly one of numbers $k,n-k-1$ is even, the sum over $k$ is twice the sum over even $k=2i$. Using the formula $${2t+1\choose m}\_{-1}={t\choose \lfloor m/2\rfloor}$$ we get
$$
a\_{4s}(-1)=\frac2{2s}\sum\_{i=0}^{2s-1}{2s\choose i}{2s\choose i}{2s\choose i+1} (-1)^i\\=-\frac1s\left[x^{2s-1}y^{2s}z^{2s+1}\right](x-y)^{2s}(x-z)^{2s}(y-z)^{2s}
$$
(because, say, if we take the monomials $x^iy^{2s-i}$, $z^{2s-i}y^i$ and $z^{i+1}x^{2s-i-1}$ from the binomials $(x-y)^{2s}$, $(y-z)^{2s}$, $(x-z)^{2s}$ respectively, the coefficient is $(-1)^{i+1}{2s\choose i}{2s\choose i}{2s\choose i+1}$). So, to confirm the guess of Brian Hopkins (with alternating sign) we should prove that
$$
\left[x^{2s-1}y^{2s}z^{2s+1}\right](x-y)^{2s}(x-z)^{2s}(y-z)^{2s}=
\frac{(-1)^{s+1}s}{2s+1}{3s\choose s,s,s}.\quad (\spadesuit)
$$
This is similar to [Dixon's identity](https://en.wikipedia.org/wiki/Dixon%27s_identity), and you may adapt your favourite proof of Dixon here. Mine favourite uses Combinatorial Nullstellensatz formula, as explained [in this answer](https://mathoverflow.net/a/214930/4312), so let me do the same for $(\spadesuit)$. We change the polynomial adding lower degree terms to
$$
f(x,y,z)=\prod\_{i=-s}^{s-1} (x-y-i)(y-z-i)(x-z-i)
$$
and look at values of $f$ when $x\in \{0,1,2,\ldots,2s-1\}$, $y\in \{0,1,\ldots,2s\}$, $z\in \{0,1,\ldots,2s+1\}$. Note that if $f(x,y,z)\ne 0$, then $|x-y|,|x-z|,|y-z|$ are at least $s$, thus either $\{x,y,z\}=\{0,s,2s\}$, or $z=2s+1$. In the first case, since $x\ne 2s$, we get either $x-y+s=0$ or $x-z+s=0$, so $f(x,y,z)=0$, a contradiction. Thus $z=2s+1$. Since $x-z+s\ne 0$, $y-z+s\ne 0$, we get $x,y\leqslant s$. Therefore $x=s$, $y=0$. So, RHS of CN formula has exactly one non-zero term, which routinely simplifies to the above answer $(\spadesuit)$.
* For $n=4s+1$ we again get $h(n,k)=0$ for odd $k$, and for the sum over even $k=2i$ we apply the identity ${n+1\choose k+1}\_q={n+1\choose 1}\_q{n\choose k}\_q/{k+1\choose 1}\_q$. This allows to cancel out the singular term ${n+1\choose 1}\_q$, and applying ${k+1\choose 1}\_{-1}=0$ for even $k$ we get
$$
a\_{4s+1}(-1)=\frac1{2s+1}\sum\_{i=0}^{2s}(-1)^i{2s+1\choose i}{2s+1\choose i+1}{2s\choose i}.
$$
This corresponds to Dyson's conjecture (now a theorem) $${\rm CT} \prod\_{i\ne j}(1-x\_i/x\_j)^{a\_i}=\frac{(\sum a\_i)!}{\prod a\_i!}$$
for $(a\_1,a\_2,a\_3)=(s,s,s+1)$, and we get Roland Bacher's answer
$$
a\_{4s+1}(-1)=\frac{(-1)^s}{2s+1}{3s+1\choose s,s,s+1}.
$$


