Relation between $(a\bmod b)\bmod c$ and $a\bmod c$

575 Views Asked by At

Will (a%b)%c be equivalent to a%c? Given $b>c$ and $b$ is a prime number?

If not is there any other equality that will hold?

Will it be equivalent to ((a%c)+(b%c))%c?

1

There are 1 best solutions below

0
On BEST ANSWER

A counterexample for $(a\bmod b)\bmod c=a\bmod c$ with $b>c$ could be possible when $b$ is close to $a$ and $c$, for example $a=b+1=c+3$ with $c$ large enough.
For example $a=20$, $b=19$, $c=17$ gives $LHS=2\neq4=RHS$. It's not hard to think of other examples, if only we have $c<b<a<2c<2b$: $LHS=a-b$ (note $0<a-b<c$) and $RHS=a-c$.

For the indentity $(a\bmod b)\bmod c=((a\bmod c)+(b\bmod c))\bmod c$ it's a good idea to look at it modulo $c$: it says $a\bmod b\equiv a+b\pmod c$.
We can find a family of counterexamples by forcing $a\bmod b=a-b$, i.e., $b<a<2b$. If $c\nmid 2b$ the congruence $a-b\equiv a+b\pmod c$ is false.
An explicit counterexample could again be $a=20$, $b=19$, $c=17$.