What is the program (in MATLAB) which has an answer to the following question.
Let $p$ be a prime number and $n$ be a natural number. We are just supposed to focus on $M_n(Z_p)$, the set of $n\times n$ matrices with entries in the field $Z_{p}$.
Definition. We say that a matrix $A$ is $k$-positive if there are matrices $X_1,\cdots,X_k$ in $M_n(Z_{p})$ with $A=X_1^tX_1+\cdots+X^t_kX_k$ ($X^t$ is the transpose of $X$).
Problem. List all (pairwise different) $k$-positive matrices where $k=1,2,\cdots$.