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.