How do I calculate:
$a \pmod c + b \pmod c$
using the modular arithmetic:
$(a+b) \pmod c = (a \pmod c + b \pmod c)\pmod c$
For example, assuming that $a=14, b=17$ and $c=5$;
$(a+b) \pmod c = (a \pmod c + b \pmod c) \pmod c$
$31 \pmod 5 = ( 4 + 2 ) \pmod 5$
I just want $6 (4+2)$ to be the output.
One way to calculate it is to perform $(a \pmod c + b \pmod c).$
But how do I calculate that value without performing in the above mentioned way but by using $(a+b) \pmod c$ ?
No comments:
Post a Comment