The structure of the $n$-th power of a special matrix

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 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}$$
Let $\left( \begin{array}{c} {g_1^{(a,b)}}(1) \\ \\ {g_2^{(a,b)}}(1) \\ \\ \vdots \\ \vdots \\ \\ {g_p^{(a,b)}}(1) \\ \end{array} \right)$ be the first column of $C_p^{(a,b)}$. From equation ${(C_p^{(a,b)})}^n=C_p^{(a,b)}\cdot {(C_p^{(a,b)})}^{n-1}$ we conclude:
$$\left\{ \begin{array}{c} g_1^{(a,b)}(n)=a\cdot (g_1^{(a,b)}(n-1)+g_2^{(a,b)}(n-1)) \\g_i^{(a,b)}(n)=a\cdot g_{i+1}^{(a,b)}(n-1) , 2\le i\le p-1\\g_p^{(a,b)}(n)=b \cdot \sum_1^p g_i^{(a,b)}(n-1) \\ \end{array} \right.$$