  Let $B$ be a nilpotent matrix and suppose that its Jordan canonical form is
determined by a partition $\lambda$. Then it is known that its nilpotent
commutator $N_B$ is an irreducible variety and that there is a unique partition
$\mu$ such that the intersection of the orbit of nilpotent matrices
corresponding to $\mu$ with $N_B$ is dense in $N_B$. We prove that map $D$
given by $D(\lambda)=\mu$ is an idempotent map. This answers a question of
Basili and Iarrobino and gives a partial answer to a question of Panyushev. In
the proof, we use the fact that for a generic matrix $A \in N_B$ the algebra
generated by $A$ and $B$ is a Gorenstein algebra. Thus, a generic pair of
commuting nilpotent matrices generates a Gorenstein algebra. We also describe
$D(\lambda)$ in terms of $\lambda$ if $D(\lambda)$ has at most two parts.
