I am trying to do the following exercise:
Let $m\in \mathbb N \backslash\{1,2\}$ and $A=(a_{ij})\in M_n(\mathbb Z)$ with $a_{ii} = 0$ for all $1\leq i\leq n$ and $a_{ij} = 1$ or $a_{ij} = m$ for all $1\leq i\neq j \leq n$. Show that $\text{rk } A = n -1$ or $\text{rk } A = n$.
Proof attempt:
Define $C:= A - B$, where $B\in M_n(\mathbb Z)$ with $b_{ij} = 1$ for all $1\leq i,j \leq n$. We then have $\det(C \mod (m-1)) = (-1)^n \neq 0 \implies \det C \neq 0$, hence $\text{rk } C = n$. I feel like I am close but don't know what's the final step. I could use $\text{rk } A = \text{rk } (C + B) \leq \text{rk }C + \text{rk }B = n$ but that is obvious in the first place. I too know that $\text{rk }A = n \Leftrightarrow A$ invertible $\Leftrightarrow \det A \in \{-1,1\}$ since $A$ has only entries from $\mathbb Z$.