Let $K$ be an algebraically closed field with characteristic $0$. I consider the Jordan decomposition of a NILPOTENT matrix: $A=diag(J_{r_1},\cdots,J_{r_s})\in M_n(K)$ where $J_k$ is the nilpotent Jordan block of dimension $k$ and with $r_1\geq\cdots\geq r_s$. Let $S(A)=\{P^{-1}AP|P\in GL_n(K)\}$ be the similarity class of $A$ and $d(A)=f(r_1,\cdots,r_s)$ be the dimension of the algebraic variety $S(A)$ (I hope that the previous assertion is true). To find $d(A)$ is equivalent to find the Hilbert dimension of the algebraic variety $\{X\in SL_n(K)|XA=AX\}$. With Maple, we can do actually the calculation until $n=7$.

For instance, for a fixed $n$, $\sup_A d(A)=n^2-n$ and this sup is reached only for $J_n$.

Does there exist an explicit formula for $f(r_1,\cdots,r_s)$, or, an algorithm that does the job within a reasonable time ? Is this problem linked to the Young tableaux ?

Thanks in advance