How to quickly calculate the modulus without calculator?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 30

How to quickly calculate the modulus without calculator??

All guys, how to quickly calculate modulus without using calculator, guys. Because Ruby, Python, Php, Java, Java, Javascript, C++, C#, and Other Language, use modulus for some calculations and many also used in " Question Challenge ". So, please tell how 🙏🙏🙏.

27th Jun 2018, 1:57 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
27 Answers
+ 15
Muhammad Akmal Naim you can do this by: First doing the division such for 47/5 which will only let you go up to 45 Then for 47%5 you do 47-45 which is 3
27th Jun 2018, 2:09 AM
Agent
Agent - avatar
+ 24
So basically the modulus function returns the remainder from the euclidian division of two numbers. Example: 15/2=2*7+1 so 15%2=1 Well there's no really a secret to it you have to know very well your multiplication tables but there are some tips and tricks: -for 2: if the number is even then the remainder will be 0 otherwise 1 -for 5: if the number ends with 0 or 5 the remainder will be 0 otherwise it will ONLY be 1 or 2 or 3 or 4 -for 3: if the sum of the number is divisible by 3 then the remainder will be 0. Example: 123%3=0 because 1+2+3=6 and 6=3*2 or 6%3=0 And there are others but then again, knowing very well your multiplication tables helps a whole lot.
28th Jun 2018, 10:32 AM
Uni
Uni - avatar
+ 16
Thanks for answer, Agent. Very helpful
27th Jun 2018, 3:06 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 16
Thanks for answer, David Masabo. Very helpful
28th Jun 2018, 10:16 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 15
Thanks, suggestion Muhammad Hasan.
27th Jun 2018, 2:53 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 15
Once again I thank you for the answer Muhammad Hasan, now i somewhat better understand how to calculate this modulus.
27th Jun 2018, 3:02 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 15
Thanks Haris, for your answer. Very helpful
28th Jun 2018, 12:32 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 15
Thanks, David Masabo, for your answer
28th Jun 2018, 6:25 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 14
Thanks Lisa F, for your answer.
27th Jun 2018, 10:36 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 13
but, how with 10 mod 7 = 3, however, if reversed 7 mod 10 = 7. or other example 4 mod 3 = 1, however, if reversed 3 mod 4 = 3. why 7 mod 10 the result remains 7 ?? please, answer Muhammad Hasan and Agent.
27th Jun 2018, 2:49 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 13
Thanks Abenezer Kebede, for your answer.
27th Jun 2018, 8:44 AM
Muhammad Akmal Naim
Muhammad Akmal Naim - avatar
+ 10
You can search it in the internet about modulus operation in mathematics, but maybe I'll give some lessons here Note: I am telling you how to calculate fastly so I assume you already know the basics of how to find a remainder In mathematics a ≡ b (mod c) means there exist an integer k so that a = bk+c so b doesn't necessarily have to be a remainder of a divided by c, but if b < c then b is called the remainder example 9 ≡ 1 (mod 2) => 9 = (4)*2+1 but could also be 9 ≡ 3 (mod 2) => 9 = (3)*2+3 9 ≡ 5 (mod 2) => 9 = (2)*2+5 and so on... Here's some of the fundamental formulas for modulo operation If a ≡ m (mod c) and b ≡ n (mod c) then: 1) a+b (mod c) ≡ m+n (mod c) 2) (a*b) (mod c) ≡ (m*n) (mod c) 3) aⁿ (mod c) ≡ mⁿ (mod c) 4) FLT Theorem If p prime and a is not divisible by p then a^(p-1) (mod p) ≡ a (mod p) 5) Wilson Theorem Again if p prime then (p-1)! ≡ p-1 (mod p) There is also Chinese Remainder Theorem for more faster calculation and many more, but this is already too long I hope this helps
27th Jun 2018, 2:11 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 10
Because 7 (mod 10) means 7 = (0)*10+7 so k = 0 in this case (see the explanation I gave) and because 7 < 10 so we'll have that 7 is the remainder of 7 divided by 10 Or an easier understanding for remainder is number = floor(number/divider)*divider+remainder *learn the function floor to understand more
27th Jun 2018, 2:52 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 9
Here are a few examples Find 1) 10^2018 (mod 9) 2) 2017*2018*2019 (mod 2016) 3) 2017+2018+2019 (mod 2016) Answer 1) Because 10 (mod 9) ≡ 1 (mod 9) we could have 10^2018 (mod 9) ≡ (1)^2018 (mod 9) ≡ 1 (mod 9) so the remainder is 1 2) It's easy to know that 2017 ≡ 1 (mod 2016) 2018 ≡ 2 (mod 2016) 2019 ≡ 3 (mod 2016) so 2017*2018*2019 (mod 2016) ≡ (1)*(2)*(3) (mod 2016) ≡ 6 (mod 2016) so the remainder is 6 3) Coming from number 2 we could have 2017+2018+2019 (mod 2016) ≡ (1)+(2)+(3) (mod 2016) ≡ 6 (mod 2016) So the remainder is 6
27th Jun 2018, 2:29 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 9
To tell you the truth, for "Question Challenges" you don't need that much understanding, you just have to understand the basic and have some practice The explanation earlier that I gave is for harder question and maybe for someone who wants to know (If there was :v)
27th Jun 2018, 2:46 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 8
Because you're from Indonesia I have a link where you should study this, it's very recommended 😉 (Non-Indonesians could try also) Cara mengerjakan soal soal tentang modulo: https://m.facebook.com/notes/osn-matematika/cara-mengerjakan-soal-soal-tentang-modulo/593356200730155/?refid=18&__tn__=H-R
27th Jun 2018, 2:16 AM
Muhammad Hasan
Muhammad Hasan - avatar
+ 8
10 cannot go into 7 so it starts at zero 7 - 0 = 7 this is always the case when they are reversed
27th Jun 2018, 2:56 AM
Agent
Agent - avatar
+ 8
No problem
27th Jun 2018, 3:08 AM
Agent
Agent - avatar
+ 8
Adi Pratama the C++ modulus operator is ‘%’. The modulus operator finds the remainder of numbers when a integer devision occurs. This example takes user input of a number and uses the modulus operatir to find out the remainder when dividing by 3 https://code.sololearn.com/cwNQQOdnYR1o/?ref=app
27th Jun 2018, 3:20 PM
Agent
Agent - avatar
+ 8
mod <--> remainder of Euclidean division guys & girls e.g. 1) 105 % 13 = 1 because 105 = 8 * 13 + 1 2) 2018 % 5 = 3 because 2018 = 403 * 5 + 3 3) 100 % 200 = 100 because 100 = 0 * 200 + 100 wiki on modulo operation: https://en.m.wikipedia.org/wiki/Modulo_operation
27th Jun 2018, 8:16 PM
Haris
Haris - avatar