Considering$$A:= \begin{pmatrix} 0 & 1 & 2 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \\ \end{pmatrix}$$
For how many integers $n$ there is a real matrix $X$ such that $X^n=A$?
I know $n=1$ is an instant solution. Maybe I can suposse some matrix $X$ with $9$ variables and try solving the system when $X^2=A$. For $X^3=A$ or with $n$ greater than $3$ , this method seems to create a difficult system to solve. I know $det(A)=0$, and that all its eigenvalues are $0$. If $A$ were a diagonalizable matrix, I guess I could write $A=PDP^{-1}$, with $D$ being a diagonal matrix, and $X$ would be $PEP^{-1}$, with $E$ being a diagonal matrix with elements that squared are the elements of $D$, but not being the case, how can I proceed?
Note that $A^2\neq0$. So, if $X^n=A$, you have $X^{2n}=A^2\neq0$. But $X$ is a $3\times3$ matrix whose only eigenvalue is $0$ (because if $\lambda$ is an eigenvalue of $X$, then $\lambda^n$ is an eigenvalue of $X^n(=A)$) and, for such a matrix, $X^n\neq0\implies n<3$. So, $2n<3$, which means that $n=1$.
Also, note that if the only eigenvalue of a $m\times m$ matrix $X$ is $0$, then its Jordan normal form has only $0$'s in and below the main diagonal. Therefore, $n\geqslant m\implies X^n=0$.