Vihaan Verma
Vihaan Verma

Reputation: 13143

Modulus operation on other side of equation?

If

I = (V+13) % 26

Then what is V in terms of 'I'. Basically how can you take the Mod operator on the other side of equation ?

Upvotes: 0

Views: 3483

Answers (1)

4pie0
4pie0

Reputation: 29734

I = (V+13) %26

This means V+13 = k*26 + I, and k=Z, I=[0,1,...,26-1]. (1)

so

V = k*26 + I -13

now, because I is remainder from division by 26, I=[0,1,...,26-1]. This means:

I%26=I, I divided by 26 is just I.

so:

I = (V+13) %26

I%26 = (V+13) %26

this is not the same as I%26 = (V+13) because I%26 = (V+13) implies V+13 = [0,1,...,26-1] what contradicts (1), (V+13 might be greater than 26-1).


Corollary:

V = (I%26) - 13 is not correct

V = (I%26) - 13 + k*26, k=Z is correct

Upvotes: 1

Related Questions