- #1
Apteronotus
- 202
- 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)
The answer is yes. The two expressions are equivalent.
"Mod" stands for modulo or modular arithmetic, which is a mathematical operation that finds the remainder after division.
Sure, for example, if a = 10 and b = 4, then (ka)mod kb would be (10*4)mod (4*4) = 40mod 16 = 8. Similarly, k(a mod b) would be k(10 mod 4) = k(2) = 2. Therefore, both expressions are equal to 8.
This equation works for any values of a and b, as long as b is not equal to 0.
This equation is commonly used in computer science and cryptography to perform operations on large numbers and ensure data security. It is also used in number theory and abstract algebra to solve mathematical problems.