Assume the following matrix
$$
C\_p^{(a,b)}:=\left(
\begin{array}{cccccc}
a &a &0 &\cdots &\cdots &0 \\
0 &0 &a &\ddots &\ddots &\vdots \\
\vdots &\ddots &\ddots &\ddots &\ddots &\vdots \\
\vdots &\ddots &\ddots &\ddots &\ddots &0 \\
0 &\cdots &\cdots &0 &0 &a \\
b &b &\cdots &\cdots &b &b \\
\end{array}
\right)\_{p \times p}\, .
$$
Where $a$ and $b$ are any integer number. With the numerical simulation, i found that the $n$th power of the matrix $C\_p^{(a,b)}$, has
the following form
$$
{(C\_p^{(a,b)})}^n:=\left(
\begin{array}{cccccc}
{g\_1^{a,b}}(n) &{g\_1^{a,b}}(n) &\cdots &\cdots &{g\_1^{a,b}}(n) \\
\\
{g\_2^{a,b}}(n) &{g\_2^{a,b}}(n) &\cdots &\cdots &{g\_2^{a,b}}(n) \\
\\
\vdots &\cdots &\cdots &\cdots &\vdots \\
\vdots &\cdots &\cdots &\cdots &\vdots \\
\\
{g\_p^{a,b}}(n) &{g\_p^{a,b}}(n) &\cdots &\cdots &{g\_p^{a,b}}(n) \\
\end{array}
\right)\_{p \times p}\, .
$$
Where ${g\_i^{a,b}}(n)$, $1\leq i \leq p$, are expressions based on the parameters $a$, $b$ and $n$. For example, two consecutive power 
of the matrix $C\_7^{(2,3)}$, are as follows 
$$
{(C\_7^{(2,3)})}^9:=
 \left( \begin {array}{ccccccc} 8000&8000&8000&8000&8000&8000&8000
\\ 12000&12000&12000&12000&12000&12000&12000
\\ 30000&30000&30000&30000&30000&30000&30000
\\ 75000&75000&75000&75000&75000&75000&75000
\\ 187500&187500&187500&187500&187500&187500&187500
\\ 468750&468750&468750&468750&468750&468750&468750
\\ 1171875&1171875&1171875&1171875&1171875&1171875&
1171875\end {array} \right)\, .
$$


$$
{(C\_7^{(2,3)})}^{10}:=
\left( \begin {array}{ccccccc} 40000&40000&40000&40000&40000&40000&
40000\\ 60000&60000&60000&60000&60000&60000&60000
\\ 150000&150000&150000&150000&150000&150000&150000
\\375000&375000&375000&375000&375000&375000&375000
\\ 937500&937500&937500&937500&937500&937500&937500
\\ 2343750&2343750&2343750&2343750&2343750&2343750&
2343750\\ 5859375&5859375&5859375&5859375&5859375&
5859375&5859375\end {array} \right)\, .
$$
Is there a way to find an explicit formula for ${g\_i^{a,b}}(n)$, $1\leq i \leq p$ in general. The matrix $C\_p^{(a,b)}$ is so interesting. 
If $a=-b$ then 
$$
\forall n\geq p \qquad {(C\_p^{(a,b)})}^n=O\_p\, .
$$
Where $O\_p$ is a zero matrix of order $p$. In some cases, ${g\_i^{a,b}}(n)$, $1\leq i \leq p$, are fixed. For example, 
if $[a=-(d\pm1) \, \& \, b=d]$ or $[b=-(d\pm1) \, \& \, a=d]$ where $d$ is an integer number, then we have 
$$
\forall n\geq p-1 \qquad {(C\_p^{(a,b)})}^n=\pm F\_p\, .
$$
Where $F\_p$ is a fixed matrix of order $p$. For example, by using $C\_5^{(-3,2)}$ and $C\_4^{(3,-4)}$, we can see that
$$
C\_5^{(-3,2)}=
\left( \begin {array}{ccccc} -3&-3&0&0&0\\0&0&-3&0
&0\\ 0&0&0&-3&0\\ 0&0&0&0&-3
\\ 2&2&2&2&2\end {array} \right) \Rightarrow 
\forall n\geq 4 \quad {(C\_5^{(-3,2)})}^n=
 \left( \begin {array}{ccccc} 81&81&81&81&81\\ -54&-
54&-54&-54&-54\\ -18&-18&-18&-18&-18
\\ -6&-6&-6&-6&-6\\ -2&-2&-2&-2&-2
\end {array} \right)\, .
$$
$$
C\_4^{(3,-4)}=
 \left( \begin {array}{cccc} 3&3&0&0\\0&0&3&0
\\ 0&0&0&3\\ -4&-4&-4&-4
\end {array} \right)
 \Rightarrow 
\forall n\geq 3 \quad {(C\_4^{(3,-4)})}^n=\pm
 \left( \begin {array}{cccc} 27&27&27&27\\ -36&-36&-
36&-36\\ 12&12&12&12\\ -4&-4&-4&-4
\end {array} \right)\, .
$$
In some especial cases, i found an expression for ${g\_i^{a,b}}(n)$, $1\leq i \leq p$. Assume $C\_p^{(a,b)}$, for $a=b=1$, as follows
$$
C\_p^{(1,1)}:=\left(
\begin{array}{cccccc}
1 &1 &0 &\cdots &\cdots &0 \\
0 &0 &1&\ddots &\ddots &\vdots \\
\vdots &\ddots &\ddots &\ddots &\ddots &\vdots \\
\vdots &\ddots &\ddots &\ddots &\ddots &0 \\
0 &\cdots &\cdots &0 &0 &1 \\
1 &1 &\cdots &\cdots &1 &1 \\
\end{array}
\right)\_{p \times p}\, .
$$
With the induction on $n$, we can prove that for $n\geq p-1$, we have 


$$
{(C\_p^{(1,1)})}^n:=\left(
\begin{array}{cccccc}
2^{n-(p-1)} &2^{n-(p-1)} &\cdots &\cdots &2^{n-(p-1)} \\
\\
2^{n-(p-1)} &2^{n-(p-1)} &\cdots & \cdots & 2^{n-(p-1)} \\
\\
2^{n-(p-2)} &2^{n-(p-2)} &\cdots & \cdots & 2^{n-(p-2)} \\
\\
2^{n-(p-3)} &2^{n-(p-3)} &\cdots & \cdots & 2^{n-(p-3)} \\
\\
\vdots &\cdots &\cdots &\cdots &\vdots \\
\vdots &\cdots &\cdots &\cdots &\vdots \\
\\
2^{n-1} &2^{n-1} &\cdots &\cdots & 2^{n-1} \\
\end{array}
\right)\_{p \times p}\, .
$$
Is there a method to find a general expression for ${g\_i^{a,b}}(n)$, $1\leq i \leq p$? I would greatly appreciate for any suggestions.



The structure of the $n$-th power of a special matrix
The characteristic polynomial of $C\_p^{(a,b)}$ is $\lambda^p - (a+b) \lambda^{p-1}$. Therefore, for $m \ge p$ we have $$(C\_p^{(a,b)})^m = (a+b)^{m-p} (C\_p^{(a,b)})^{p-1}$$
It appears that $B = (C\_p^{(a,b)})^{p-1}$ has entries
$$ \eqalign{b\_{1j} &= a^{p-1}\cr
 b\_{ij} &= a^{p-i} b (a+b)^{i-2}\ \text{for}\ i \ge 2\cr}$$


EDIT:
We can exhibit the Jordan form of $C\_p^{(a,b)}$ explicitly: $C\_p^{(a,b)} = S J S^{-1}$ where


$$ J = \pmatrix{0 & 1 & 0 & \ldots & 0 & 0\cr
 0 & 0 & 1 & \ldots & 0 & 0\cr
 0 & 0 & 0 & \ldots & 0 & 0\cr
 \ldots &\ldots &\ldots &\ldots & \ldots & \ldots\cr
 0 & 0 & 0 & \ldots &1 & 0\cr 
 0 & 0 & 0 & \ldots & 0 & 0\cr
 0 & 0 & 0 & \ldots & 0 & a+b\cr} $$
$$ S = \pmatrix{\frac{a^{p-2} b}{a+b} & \frac{a^{p-3}(a+b)^2 - a^{p-1}}{(a+b)^2} & \frac{a^{p-4}(a+b)^3 - a^{p-1}}{(a+b)^3} & \ldots & \frac{(a+b)^{p-1} - a^{p-1}}{(a+b)^{p-1}} & \frac{a^{p-1}}{(a+b)^{p-1}}\cr
-\frac{a^{p-2} b}{a+b} & -\frac{a^{p-2} b}{(a+b)^2} & -\frac{a^{p-2} b}{(a+b)^3} & \ldots & -\frac{a^{p-2} b}{(a+b)^{p-1}} & \frac{a^{p-2} b}{(a+b)^{p-1}}\cr
0 & -\frac{a^{p-3} b}{a+b} & -\frac{a^{p-3} b}{(a+b)^2} & \ldots & -\frac{a^{p-3} b}{(a+b)^{p-2}} & \frac{a^{p-3} b}{(a+b)^{p-2}}\cr
 \ldots &\ldots &\ldots &\ldots & \ldots & \ldots\cr
0 & 0 & 0 & \ldots & -\frac{b}{a+b} & \frac{b}{a+b}}$$
$$ S^{-1} = \pmatrix{0 & -\frac{a+b}{a^{p-2} b} & \frac{1}{a^{p-3} b} & 0 & \ldots & 0 & 0\cr
0 & 0 & -\frac{a+b}{a^{p-3} b} & \frac{1}{a^{p-4} b} & \ldots & 0 & 0\cr
0 & 0 & 0 & -\frac{a+b}{a^{p-4} b} & \ldots & 0 & 0\cr
 \ldots &\ldots &\ldots &\ldots & \ldots & \ldots & \ldots \cr
0 & 0 & 0 & 0 & \ldots & -\frac{a+b}{ab} & \frac{1}{b}\cr 
1 & 1 & 1 & 1 & \ldots & 1 & -\frac{a}{b}\cr
1 & 1 & 1 & 1 & \ldots & 1 & 1\cr}$$


