# Generalizing Kasteleyn's formula even more?

Inspired and intrigued by this question, I decided just for fun to throw in another integer into the factors and look what happens. So for $k\in\mathbb Z$, let us define $$K_r(n,k):=\prod_{\ell_1=1}^n\cdots\prod_{\ell_r=1}^n\left( 4\cos^2\left(\frac{\pi\ell_1}{2n+1}\right)+\cdots+4\cos^2\left(\frac{\pi\ell_r}{2n+1}\right)\color{red}{+k}\right).$$

(Notation: it would look better to write $K_n(r,k)$ instead, as $r$ and $k$ are variable while $n$ will be rather kept constant, but I have chosen to keep it compatible with the previous question. Thus the index $r$ corresponds to the "complexity" of the product.)

Lucia's comment applies to this generalization as well, showing that the $K_r(n,k)$ are still integers.

Now, most amazingly, all their prime factors seem to be about as small as for the $k=0$ case!
They are even smaller for 'slightly' negative $k$, reaching as extremal cases e.g. $$K_3(4,-6)= K_3(4,-3)= K_4(4,-7)=K_4(4,-4)= K_5(4,-8)= K_5(4,-5)= 1,$$ a pattern which suggests $$K_r(4,-r-3)=K_r(4,-r)=1.$$ But note that even though this identity is "only" about $9$th roots of unity, it seems far from trivial.

• Any idea how to prove it?

Likewise we have $K_4(2,-6)= K_5(2,-5)= K_5(2,-10)= K_6(2,-9)= 1$, but those four identities involving $5$th roots of unity seem to be sporadic.

From time to time, there are some pure powers among the $K_r(n,k)$'s, like $$K_3(3,-4)=13^4,\quad K_5(2,-10)= K_5(2,-5)= 5^{17},\quad K_4(2,-8)=-2^{10}.$$ But no appearing pattern. Note that occasionally the product vanishes, e.g. $K_3(4,-6)=0.$

And what about recurring factors, as seen e.g. by comparing $K_5(3,-13)=2^{60}7^{91}13^{35}29^{1}$ with $K_5(3,-6)=-7^{91}13^{6}$?

Like the $k=0$ case, the values $K_r(n,k)$ seem to be "essentially" $r$-th powers, i.e. if $m^r$ is the biggest $r$-th power contained in $K_r(n,k)$, then not very much remains for the "$r$-remainder" $\dfrac{K_r(n,k)}{m^r}$. Interesting because the product $K_r(n,k)$ has $r$ factors. What does that mean?...

Numerical experiments suggest that if $r$ is a prime, the $r$-remainder of $K_r(n,k)$ always divides the polynomial value $$p_n(r,k):=\sum_{i=0}^n\binom{2n-i}ik^{n-i}r^i$$ (see oeis.org/A054142 for the coefficients and some combinatorial properties of what seems to be called Morgan-Voyce polynomials), with the quotient being some small power, which is often $\pm1$, e.g. systematically for $n=2$. (NB. Here it was really necessary to choose the somewhat incompatible notation $p_n(r,k)$ instead of $p_r(n,k)$ because $n$ does not vary.)

Any idea why the Morgan-Voyce polynomials come in here?

This behavior is very similar for the $2$-remainder of $K_4(n,k)$ (not for the $4$-remainder), so it possibly extends from primes $r$ to prime powers $r$. But for $r=6$ the patterns become messy.

Note that all this doesn't say anything about the other prime divisors involved (meaning those of $m^r$, i.e. of $m$), but it might be a start in understanding what is happening here. And it may be a hint towards the conjecture that also the other prime divisors grow only polynomially with $r$.

EDIT: If we keep $r,n$ constant, then $K_r(n,k)$ is by definition a polynomial in $k$ of degree $n^r$. Now:

Numerical evidence suggests that this polynomial is always 'highly reducible', meaning that all its irreducible factors have degrees at most $n$.
A proof of this would readily answer the original question why all the prime factors of $K_r(n,0)$ are relatively small.

For example, $$K_3(3,k-5)=k^6 (k^3-7k-7)^3(k^3-7k+7)^3(k^3-21k+7)$$ Note that the shifting of $k$ by $5$ makes the factors look nicest. I have no idea why the primes $5$ and $7$ are featured for $K_3(3,k)$.
Likewise $$K_3(4,k-6)=(k-3)k^6f(k)^6 [ -f(-k+3) ]^3 (k^3 - 9k - 9 )^3 (k^3 - 9k + 9 )^3 \\ \cdot (k^3 - 3k^2-9k+3)^ 3(k^3 - 27k - 27)$$ where $f(k)=k^3 - 3k^2 + 3$.

Might there be a connection with the abelian group $\mathbb Z_n ^r$, with its structure giving insights into this polynomial factorization?

For $r=2$, the (generalized) polynomials $$\prod_{\ell_1,\ell_2=1}^n\left( 4a^2\cos^2\left(\frac{\pi\ell_1}{2n+1}\right)+4b^2\cos^2\left(\frac{\pi\ell_2}{2n+1}\right)+z^2\right)$$ appear in the context of statistical model of current loops and magnetic monopoles as partition functions (see Theorem 4.1, p.9).