Solution (source code)

= Solution

Let $x$ and $y$ denote the two oriented noncontractible cycles of the <torus>. Their transport operators intersect once, so the mutual braiding phase gives the <Wilson-loop algebra of an Abelian Chern--Simons theory>
$$
\boxed{T_x(q')T_y(q)
=e^{2\pi i q'^TK^{-1}q}T_y(q)T_x(q').}
$$
The integer charge vectors are identified modulo local electrons: $q$ and $q+K\ell$ have identical braiding with every quasiparticle. The distinct topological charges therefore form the finite <quotient group>
$$
\mathcal A=\mathbb Z^n/K\mathbb Z^n,
\qquad |\mathcal A|=|\det K|.
$$

Choose a ground state that diagonalizes the mutually commuting $x$-cycle operators. Acting with $T_y(q)$ multiplies their eigenvalues by the character $q'\mapsto e^{2\pi i q'^TK^{-1}q}$. This pairing is nondegenerate on $\mathcal A$: if the character is trivial for every $q'$, then $K^{-1}q$ is integral and $q$ is the trivial class. Thus the $|\mathcal A|$ states obtained from inequivalent $q$ have distinct loop eigenvalues and are orthogonal. The <torus ground-state degeneracy of an Abelian Chern--Simons theory> is consequently at least $|\det K|$.

The all-ones matrix has eigenvalue $n$ along $t$ and eigenvalue zero on the $(n-1)$-dimensional perpendicular subspace. Hence $K=I_n+pM$ has eigenvalues $1+np,1,\ldots,1$, and
$$
\boxed{|\det K|=|1+np|.}
$$