Friday, 15 January 2010

discrete mathematics - (a mod 2*x)-(a mod x) -



discrete mathematics - (a mod 2*x)-(a mod x) -

i trying find possible values of expression.

(a mod 2*x)-(a mod x)

i suspect might 0 or x, i'm not sure. can't seem able write downwards proper argument.

you right possible values 0 , x, assuming both a , x positive. logic follows.

let a have form

a = p*x + b

then easy see a mod x = b.

for a mod 2*x, if p = 2*r (p even) then

a = 2*r*x + b = (2*x)*r + b

so a mod 2*x = b , p = 2*r + 1 (p odd) then

a = (2*r + 1)*x + b = 2*r*x + x + b = (2*x)*r + x + b

so a mod 2*x = x + b. combining these results, difference either b - b = 0 (when p even) or (x + b) - b = x (when p odd).

discrete-mathematics modulus

No comments:

Post a Comment