# Invariance of residues modulo $p$

Let $p$ be an odd prime. Is it true that there exists a permutation $\sigma$ of the set
$$\{1,\ldots,2p-1\}\setminus \{p\}$$
such that
$$\{\sigma(1),\ldots,(p-1)\sigma(p-1)\}=\{\sigma(p+1),\ldots,(p-1)\sigma(2p-1)\}=\{1,\ldots,p-1\}$$
in $\mathbf{Z}/p\mathbf{Z}$? [The answer is positive for $p \in \{3,5\}$]

An easier version of the problem asks for the existence of a permutation $\mu$ of $\{1,\ldots,p-1\}$ such that $\{\mu(1),\ldots,(p-1)\mu(p-1)\}=\{1,\ldots,p-1\}$ in $\mathbf{Z}/p\mathbf{Z}$.

In this case, the answer is negative since the products of the elements of each set would be the same modulo $p$, which is false by Wilson’s theorem (indeed we would have $1\equiv -1\pmod{p}$ for an odd prime $p$). Note that the same method does not apply to the above problem.

On the other hand, an attempt would be: the product of those three sets are the same modulo $p$, hence (here we don’t even need Wilson’s theorem) we ask: “Does there exist a partition of $\{1,\ldots,2p-1\}\setminus \{p\}$ in two sets with $p-1$ elements such that the product of the elements of each set is $1$ modulo $p$? [Edit: the answer is positive for $p \in \{3,5,7\}$]

The motivation for this question is related to this thread and this post.

Edit: Another variant here.

#### Solutions Collecting From Web of "Invariance of residues modulo $p$"

Based on the above comments, we can prove the answer is always positive. Indeed the question simplifies to the existence of a permutation $\sigma$ of $\mathbf{Z}_{p-1} \times \{1,2\}$ (with $\mathbf{Z}_{p-1}$ written additively) such that $x\mapsto x+\sigma(x,a)$ is a permutation of $\mathbf{Z}_{p-1}$ for every $a \in \{1,2\}$ (with the notation of Henning).

The answer is positive also replacing $p-1$ with an even positive integer $2n$. Indeed it is enough to set
$$\sigma(i,1)=(i\bmod{n}) \text{ }\text{ }\text{ and }\text{ }\text{ }\sigma(i,2)=n+(i\bmod{n})$$
for all $i=1,\ldots,2n$.