The Gateway to Computer Science Excellence
0 votes
63 views
What is −6 mod 18?

Please elaborate.
in Numerical Ability by Active (1.4k points) | 63 views
+2
It is $((-6) + 18)\; mod \; 18 =12$

$x \;mod\; n = (x + n)\; mod \;n = (x + 2n)\; mod n = ....= (x+kn)\; mod\; n$ , where $k$ is an integer(either positive , negative or zero)

We can verify it by $(a+b)\; mod\; n \;=(a \;mod \;n + b\; mod \;n)\; mod\; n$.

$mod$ $n$ represents total $n$ equivalence classes(partitions) and each class represents remainders $0,1,2,....,(n-1)$

Suppose , we have to do $mod \;3$ operation on numbers then possible remainders will be $0,1,2$

{$0,1,2$}

Now add 3 to each number in the set.

{$3,4,5$}

Now again add 3 to each number in the set.

{$6,7,8$}

Now again add 3 to each number in the set.

{$9,10,11$}

....................

{$3k , 3k+1,3k+2$}, where , $k$ is an integer

Here , we have 3 equivalence classes.

1) {$.....-6,-3,0,3,6,9,...,3k,...$} represents remainder $0$ class

2) {$.....-5,-2,1,4,7,10,...,3k+1,...$} represents remainder $1$ class

3) {$.....-4,-1,2,5,8,11,...,3k+2,...$} represents remainder $2$ class

In each set , every number comes after a fixed interval of $3$.

Now, here, for mod 18 , possible remainders are from 0 to 17...

Suppose , we have to find the set of numbers which gives remainder 12. So , we have to add/subtract a fixed interval 18 to each number in the set here.Since , 12 will definitely will be in the set.

So, set will be {$...,-24,-6,12,30,48,....$}

So, $-6 \;mod \;18$ is same as $12\; mod\; 18$  which is also same as $30\; mod \;18$ because all are giving same remainder.
+1
Thank you very much @ankitgupta.1729 for explaining!

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,373 answers
198,511 comments
105,285 users