Skip to main content
3 of 4
added 122 characters in body
Neil Strickland
  • 56.9k
  • 7
  • 142
  • 262

By the Chinese Remainder Theorem, we can reduce to the following cases:

  1. $N$ is coprime with $6$
  2. $N$ is a power of $3$
  3. $N$ is a power of $2$

Suppose that $N$ is coprime with $6$ and that $-3$ is a square mod $N$, say $\rho^2=-3\pmod{N}$. Put $\omega=(-1+\rho)/2$ so $\omega^2=\omega^{-1}=-1-\omega=(-1-\rho)/2$ in $\mathbb{Z}/N$. Put \begin{align*} X &= (U+V+W)/3 \\ Y &= (U+\omega V+\omega^2W)/3 \\ Z &= (U+\omega^2V+\omega W)/3 \end{align*} Then your equation becomes $UVW=1\pmod{N}$, so you can take $U$ and $V$ to be arbitrary numbers that are coprime to $N$, and $W=1/(UV)\pmod{N}$.

I have not worked out what happens if $N$ is coprime with $6$ but $-3$ is not a square mod $N$.

Experiment suggests that if $N=2^k$ and $X$ and $Y$ are given with $(X,Y)\neq(1,1)\pmod{2}$ then there is a unique $Z$, so the number of solutions is $\frac{3}{4}.2^{2k}$. This should be provable by a kind of Newton-Raphson iteration, but I have not worked out the details.

Experiment also suggests that if $N=3^k$, then the number of solutions is $3^{2k}$. More precisely, given $X,Y$ with $X=Y=0\pmod{3}$ then there are $3$ possible choices for $Z$, each satisfying $Z=1\pmod{3}$. This gives $3^{2k-1}$ different solutions, and by adding in cyclic permutations of these, we get $3^{2k}$ solutions. [This corrects an earlier description of the case $N=3^k$ which was mistaken.]

Neil Strickland
  • 56.9k
  • 7
  • 142
  • 262