<s>[INST] A $3\times 3$ matrix to the power of $n$. I can't find a formula for :
$$
        A =\begin{pmatrix}
        1 & 1 & 0 \\
        0 & 2 & 1 \\
        0 & 0 & 3 \\
        \end{pmatrix}^n
$$
I tried to separate $A = I + J$ with $J$ nilpotent but I didn't success.
Can you give me a hint?
Thanks.
 [/INST] After computing a few terms, we see that
$$
\begin{pmatrix}
        1 & 1 & 0 \\
        0 & 2 & 1 \\
        0 & 0 & 3 \\
\end{pmatrix}^n
=
\begin{pmatrix}
        1 & 2^n-1 & a_n \\
        0 & 2^n & 3^n-2^n \\
        0 & 0 & 3^n \\
\end{pmatrix}
$$
where, $a_n=S(n+1,3)$, Stirling numbers of second kind (A000392). 
In this case, as noted by @Joffan,
$$
a_n = \dfrac{(3^n-2^n)-(2^n-1)}{2}= \dfrac{3^n-2^{n+1}+1}{2}
$$
All this comes from expanding
$$
\begin{pmatrix}
        1 & a & b \\
        0 & c & d \\
        0 & 0 & e \\
\end{pmatrix}
\begin{pmatrix}
        1 & 1 & 0 \\
        0 & 2 & 1 \\
        0 & 0 & 3 \\
\end{pmatrix}
=
\begin{pmatrix}
        1 & 2a+1 & a+3b \\
        0 & 2c & c+3d \\
        0 & 0 & 3e \\
\end{pmatrix}
$$
and noting that the relations $a=c-1, d=e-c, 2b=d-a$ are preserved.
</s>