What is a good method to solve $x^2=0, \mod m$, for composite $m$, for a range of $m$, suitable for implementation on a computer? For some strange reason I cannot find any good references on this. Perhaps this is too easy if one has a background in basic number theory (which I don't). I guess one uses the Chinese reminder theorem in some way by factoring $m$. However, when the right hand side is zero, are there shortcuts?
2 Answers
If $m=p_1^{n_1}\ldots p_k^{n_k}$ with distinct primes $p_1,\ldots,p_k$, then
$\Bbb Z_m \rightarrow\prod_i \Bbb Z_{p_i^{n_i}}: x\mapsto (x\mod p_1^{n_1},\ldots, x\mod p_k^{n_k})$ is a ring isomorphism.
So you solve the problem $x^2=0$ in each $\Bbb Z_ {p_i^{n_i}}$. Here $x$ is a zero divisor and so must be a multiple of $p_i$.
When you have found solutions $(x_1,\ldots,x_k)$, you can find a solution in $\Bbb Z_m$ by solving the following congruences (Chinese remainder theorem) for $x$:
$x \equiv x_1\mod p_1^{n_1},\ldots,x \equiv x_k\mod p_k^{n_k}$.

- 20,964
-
1Ah, yes. Thanks. The part that helps me is "Here $x$ is a zero divisor and so must be a multiple of $p_i$". Thanks. – Jap88 Mar 12 '22 at 16:24
-
@Jap88 Here CRT is only used to infer $,p_1^{n_1}\cdots p_k^{n_k}\mid m\iff p_1^{n_1}\mid m,\cdots, p_k^{n_k}\mid m.,$ It's a bit overkill to use CRT for that obvious consequence of unique prime factorization (aka Fund. Theorem of Arithmetic). More generally see CCRT = Constant-case CRT for these and related equivalences. – Bill Dubuque Mar 12 '22 at 19:30
-
Thanks. (I am wondering what the downvote is all about.) – Jap88 Mar 13 '22 at 15:45
It is trivial if you know a prime factoriztion of $\,m\,$ since e.g. $\,p^j q^k\mid x^2\!\iff p^{\lceil j/2\rceil}, q^{\lceil k/2\rceil}\mid x,\,$ whose proof is clear using unique prime factorization (Fund. Theorem of Arithmetic).
But no efficient method is know to compute prime factorizations. Further, if we had an efficient algorithm for this problem then iterating it would yield an efficient algorithm for computing the radical of an integer (product of its prime factors). But - like factorization - that too has no known efficient algorithm.

- 272,048
-
Thanks. For the moment I am interested in relatively small $m$. But yes, otherwise it is troublesome. – Jap88 Mar 12 '22 at 16:30