Apteronotus
- 201
- 0
Hi
Just a simple Mod question.
Is (ka)mod kb = k(a mod b)?
Thanks
Just a simple Mod question.
Is (ka)mod kb = k(a mod b)?
Thanks
Apteronotus said:Yes I do believe I am correct. Suppose
ka mod kb = c
and
a mod b = d
then this means that
ka = Z(kb)+c
and
a = Z(b)+d
where Z is an integer
Hence c/k=d, and if this is true then
ka mod kb = c = kd = k(a mod b)
Thank you for your reply anyway.
kntsy said:This is a special case.
[itex]ka=Z(kb)+c[/itex] and [itex]a=Z'(b)+d[/itex],where[itex]Z,Z'\in\mathbb Z[/itex]
But generally,[itex]Z\not =Z'[/itex]
JSuarez said:..., hence (kb mod ka) = a mod b, for [itex]k\geq 0[/itex].
HallsofIvy said:(ka) mod kb is the remainder when ka is divided by kb. Obviously, ka/kb= a/b and so has the same remainder as a divided by b. Therefore, the answer to your question is "no". What is true is that (ka) mod kb= a mod b.
zgozvrm said:And, by the way, the answer (if it was unclear by reading through this thread), is "yes"
k * (a mod b) = (ka) mod (kb) for ALL a, b, k such that k<>0 and b<>0 (otherwise, you will have a divide-by-zero error)