<s>[INST] Factor the matrix (scalar $\times A$) into permutations of $A$ Here's an example of $A . B = scalar \times C$, done with magic squares. The last square does not have a consecutive range of digits.

Drop the magic square requirement.  In $2\times2$ matrices we have the following, where a matrix times a scalar is factored into permutations of the original matrix. All entries of the matrix are distinct.

$$(\begin{pmatrix} -1 & 0 \\  2 & 1  \\  \end{pmatrix} + a)\cdot (\begin{pmatrix} 1 & 0 \\  -1 & 2  \\ \end{pmatrix}+a) = (2 a + 1)\times(\begin{pmatrix} -1 & 0 \\  1 & 2  \\  \end{pmatrix}+a)$$

Here are examples with $3 \times 3$ matrices.  Can these be canonicalized in some way and all solutions listed?

$$ \begin{pmatrix} 3 & 2 & 4 \\  1 & -3 & -1 \\ -4 & 0 & -2 \\ \end{pmatrix} \cdot 
\begin{pmatrix} -3 & -1 & 2 \\  -2 & 0 & 3 \\ 4 & 1 & -4 \\ \end{pmatrix} = 
\begin{pmatrix} 3 & 1 & -4 \\  -1 & -2 & -3 \\ 4 & 2 & 0 \\ \end{pmatrix}$$
$$ \begin{pmatrix} 4 & -2 & 1 \\  -3 & 2 & -1 \\ -4 & 3 & 0 \\ \end{pmatrix} \cdot 
\begin{pmatrix} 1 & -1 & -2 \\  2 & 0 & -4 \\ 3 & 4 & -3 \\ \end{pmatrix} = 
\begin{pmatrix} 3 & 0 & -3 \\  -2 & -1 & 1 \\ 2 & 4 & -4 \\ \end{pmatrix}$$
$$ \begin{pmatrix} -1 & 0 & 1 \\  3 & 4 & -3 \\ -2 & -4 & 2 \\ \end{pmatrix} \cdot 
\begin{pmatrix} 4 & -1 & -3 \\  0 & -2 & 2 \\ 3 & -4 & 1 \\ \end{pmatrix} = 
\begin{pmatrix} -1 & -3 & 4 \\  3 & 1 & -4 \\ -2 & 2 & 0 \\ \end{pmatrix}$$
$$ \begin{pmatrix} 4 & -3 & -4 \\  -1 & 1 & 0 \\ -2 & 2 & 3 \\ \end{pmatrix} \cdot 
\begin{pmatrix} -1 & 4 & -2 \\  2 & 0 & -4 \\ -3 & 3 & 1 \\ \end{pmatrix} = 
\begin{pmatrix} 2 & 4 & 0 \\  3 & -4 & -2 \\ -3 & 1 & -1 \\ \end{pmatrix}$$ 

Is there a way to solve "Factor $A =\begin{pmatrix} -4 & 0 & -3 \\  3 & 4 & -1 \\ 1 & 2 & -2 \\ \end{pmatrix}$ into permutations of $A$." ?
Can examples be made with larger matrices?
 [/INST] Try
$$ \pmatrix{7 & -3 & 6 & 8 \cr
1 & -5 & 4 & -1 \cr
-7 & 3 & -4 & -6 \cr
0 & -2 & 5 & 2 \cr}
\pmatrix{
-5 & 3 & 7 & -1 \cr
-6 & 4 & 8 & -2 \cr
-4 & 2 & 6 & 0 \cr
5 & -3 & -7 & 1 \cr}
=\pmatrix{
-1 & -3 & 5 & 7 \cr
4 & -6 & -2 & 8 \cr
3 & 1 & -7 & -5 \cr
2 & -4 & 0 & 6 \cr}$$
and
$$
\pmatrix{
4 & -6 & 0 & 8 \cr
-2 & -1 & 3 & 1 \cr
-5 & -4 & -7 & -3 \cr
7 & 6 & 5 & 2 \cr}
\pmatrix{5 & -4 & -6 & -2 \cr
-5 & 4 & 7 & 1 \cr
3 & -1 & -3 & 0 \cr
-7 & 6 & 8 & 2 \cr} =\pmatrix{
-6 & 8 & -2 & 2 \cr
-3 & 7 & 4 & 5 \cr
-5 & -7 & -1 & 0 \cr
6 & 3 & 1 & -4 \cr}
$$
</s>