Artificial intelligent assistant

Prove that a number is prime iff the factorial of its predecessor is the predecessor of one of its multiples. !enter image description here I have tried to prove this via algbra but I got stuck. I was wondtering if there is any other way to prove this, like with a theorm. Any ideas are welcome!

For the forward direction: The case $n=2$ is easy. Assume $n$ is an odd prime. We know $(n-1)!$ is a product of units mod $n$. If you pair up the elements which are not their own inverses mod $n$ they cancel. You are left with a product of elements which are their own inverses. But the only such elements are $1$ and $n-1$ since there can be at most two square roots of $1$ over any field.

For the backward direction: If $n$ is not prime then one of the numbers $1,\dots,n-1$ is a zero divisor mod $n$ so the product cannot be congruent to $-1$ mod $n$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0dde8781819479db3433fa6390822c02