Why does 2 mod 4 = 2?
Solution 1:
Mod just means you take the remainder after performing the division. Since 4 goes into 2 zero times, you end up with a remainder of 2.
Solution 2:
Modulo is the remainder, not division.
2 / 4 = 0R2
2 % 4 = 2
The sign %
is often used for the modulo operator, in lieu of the word mod
.
For x % 4
, you get the following table (for 1-10)
x x%4
------
1 1
2 2
3 3
4 0
5 1
6 2
7 3
8 0
9 1
10 2
Solution 3:
Modulo (mod, %) is the Remainder operator.
2%2 = 0 (2/2 = 1 remainder 0)
1%2 = 1 (1/2 = 0 remainder 1)
4%2 = 0 (4/2 = 2 remainder 0)
5%2 = 1 (5/2 = 2 remainder 1)
Solution 4:
Much easier if u use bananas and a group of people.
Say you have 1 banana and group of 6 people, this you would express: 1 mod 6
/ 1 % 6
/ 1 modulo 6
.
You need 6 bananas for each person in group to be well fed and happy.
So if you then have 1 banana and need to share it with 6 people, but you can only share if you have 1 banana for each group member, that is 6 persons, then you will have 1 banana (remainder, not shared on anyone in group), the same goes for 2 bananas. Then you will have 2 banana as remainder (nothing is shared).
But when you get 6 bananas, then you should be happy, because then there is 1 banana for each member in group of 6 people, and the remainder is 0 or no bananas left when you shared all 6 bananas on 6 people.
Now, for 7 bananas and 6 people in group, you then will have 7 mod 6 = 1
, this because you gave 6 people 1 banana each, and 1 banana is the remainder.
For 12 mod 6
or 12 bananas shared on 6 people, each one will have two bananas, and the remainder is then 0.
Solution 5:
2 / 4 = 0 with a remainder of 2