Skip to main content
2 of 4
added 827 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$.

If $N=3$, then the equation is equivalent to $X+Y+Z=0\pmod{3}$ so there are $9$ solutions. Experiment suggests that if $N=3^k$ and $X$ and $Y$ are given, then there is a unique $Z$ such that the equation is satisfied, so the number of solutions is $3^{2k}$. Similarly, 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}$. Both of these things should be provable by a kind of Newton-Raphson iteration, but I have not worked out the details.

Neil Strickland
  • 56.9k
  • 7
  • 142
  • 262