Modulo of modulo. Let $p,N$ be positive integers with $N$ divides $p$. Does for every integer $X$, $[X\pmod{N}]\pmod{p}=X\pmod{p}$?

489 Views Asked by At

Let $p,N$ be positive integers with $N$ divides $p$. Does for every integer $X$, $[X\pmod{N}]\pmod{p}=X\pmod{p}$?

This question is similar to [1] - I consider it different due to $N$ now dividing $p$ instead.

I am trying to simplify the expression: $$\phi(n)=[(4n)*((4n)^{-1}\pmod{65537})]\pmod{65537*4*n}$$ where $\phi(n)$ is Euler's totient function, and I'm thinking of using the result above for simplifying the RHS.

[The particular example using 65537 I have derived using congruences on the RSA system and application of the CRT.]

Please state what the correct result is and why it's correct. [1][Modulo arithmetic (modulo of modulo)

1

There are 1 best solutions below

4
On

If $\,\gcd(4n,p) = 1\,$ then by CRT = Chinese Remainder Theorem (or Easy CRT) we have

$$\begin{align} &x\equiv 0\pmod{4n}\\ &x\equiv 1\pmod{p}\end{align}\,\iff\, x\equiv 4n((4n)^{-1}\bmod p) \pmod{\!4np}$$

Or, expressed in operator form, using the mod Distributive Law

$$ x\bmod 4np \,=\, 4n((4n)^{-1}\bmod p)$$

Generally there is no way to further simplify that other than computing the inverse.

The titled equation is not generally true, i.e. generally

$$ (x\bmod N)\bmod NK \,\neq\, x\bmod NK$$

For example when $\,x = N\,$ it becomes $\, 0 \neq N\bmod NK,\,$ true for all $K>1$ (and $N\neq 0)$