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
The discussion centers on the mathematical relationship between the expressions (ka) mod kb and k(a mod b). Participants conclude that the correct relationship is k(a mod b) = (ka) mod (kb) for all integers a, b, and k, provided k and b are non-zero. The proof involves the definition of the mod function and the properties of integer division. Counterexamples illustrate that (ka) mod kb does not equal a mod b in general cases, emphasizing the importance of understanding the conditions under which these equations hold true.
PREREQUISITESMathematicians, computer scientists, and students studying number theory or modular arithmetic will benefit from this discussion, particularly those interested in the properties and applications of modular functions.
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.
ka=Z(kb)+c and a=Z'(b)+d,whereZ,Z'\in\mathbb Z
But generally,Z\not =Z'
JSuarez said:..., hence (kb mod ka) = a mod b, for k\geq 0.
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)