## AX=XB and the Cecioni--Frobenius theorem

The Frobenius--Cecioni theorem states that if $A$ and $B$ are square matrices with entries in a field $k$ then the dimension of the $k$ vector space of solutions of $$AX=XB$$ is given by the sum $$\sum_{i,j} \deg( \gcd(d_i(A),d_j(B)))$$ Here $d_i(\cdot)$ denotes the $i$th invariant factor of its argument. My question: How well known is this theorem in any particular context? (E.g., "I use it all the time and I work in number theory ...", "I've never heard of it and I taught abstract algebra for years ...") Are there any well known applications of this result?

-

I still do not know an answer to the natural question: For a given $n$, what are the possible values of $m$ such that there exist two $n\times n$ matrices $A$ and $B$ with $\dim\left\lbrace X\in k^{n\times n}\mid AX=XB\right\rbrace = m$ ? This is equivalent to asking for the possible values of $\sum\limits_{i} a_ib_i$ where $\left(a_i\right)$ and $\left(b_i\right)$ are two finite sequences of nonnegative integers satisfying $\sum\limits_i a_i\leq n$ and $\sum\limits_i b_i\leq n$. This is a purely combinatorial question. Maybe you happen to know an answer to it, since I am hardly the first person to pose it?...