Answer: 4 mod 2 is 0. Let's find 4 mod 2. Explanation: 4 mod 2 equals 0, since 4/2 = 2, with a remainder of 0. To find 4 mod 2 using the modulus method, we first find the highest possible multiple of the divisor, 2 that is equal to or less than the dividend, 4.
To find 1 mod 4 using the modulus method, we first find the highest multiple of the divisor, 4 that is equal to or less than the dividend, 1. Then, we subtract the highest multiple from the dividend to get the answer to 1 mod 4.
Enter the Modulo The modulo operation (abbreviated “mod”, or “%” in many programming languages) is the remainder when dividing. For example, “5 mod 3 = 2” which means 2 is the remainder when you divide 5 by 3.
Answer: 2 mod 3 is 2. Let's find 2 mod 3. Explanation: 2 mod 3 equals 2, since 2/3 = 0 with a remainder of 2. To find 2 mod 3 using the modulus method, we first find the highest multiple of the divisor, 3 that is equal to or less than the dividend, 2.
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.
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
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)
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.
2 / 4 = 0 with a remainder of 2
I was confused about this, too, only a few minutes ago. Then I did the division long-hand on a piece of paper and it made sense:
That's as far as the computer is going to take this problem. The computer stops there and returns the 2, which makes sense since that's what "%" (mod) is asking for.
We've been trained to put in the decimal and keep going which is why this can be counterintuitive at first.
Someone contacted me and asked me to explain in more details my answer in the comment of the question. So here is what I replied to that person in case it can help anyone else:
The modulo operation gives you the remainder of the euclidian disivion (which only works with integer, not real numbers). If you have A such that A = B * C + D (with D < B), then the quotient of the euclidian division of A by B is C, and the remainder is D. If you divide 2 by 4, the quotient is 0 and the remainder is 2.
Suppose you have A objects (that you can't cut). And you want to distribute the same amount of those objects to B people. As long as you have more than B objects, you give each of them 1, and repeat. When you have less than B objects left you stop and keep the remaining objects. The number of time you have repeated the operation, let's call that number C, is the quotient. The number of objects you keep at the end, let's call it D, is the remainder.
If you have 2 objects and 4 people. You already have less than 4 objects. So each person get 0 objects, and you keep 2.
That's why 2 modulo 4 is 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With