Numerical Methods at work

Disclaimer:
Permission to use, copy, and distribute this software, and It’s documentation for any non-commercial purpose is hereby granted without fee, provided: THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL Henrik Vestermark, BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Practicing "Casting out 9" and other Modulo Math Trick

Practice Mental Modulo Calculation: vs. 1.2



Answer, Result & Score


0%  100%
Options: Number of Digits 2  3  4  5  6  7  8  9



  • Result
  • Help

For mental practicing the Modulo operator this application makes it easy to do so in a few steps.

  1. First you select which Modulo number operation you want to practice from 2 to 11 for later reference we call it M.
  2. Then select or adjust the number options or how many digits your test number should contain. You need to select at least one option to proceed. You can select several numbers of digits e.g. 3,5,6,7 which will allow, the program to generate random test numbers containing 3, 5,6, or 7 random digits.
  3. Next press the generate next test button to generate a random test number x.
  4. Do the mental Modulo operation in your head and select the right answer digit which is the result of the test number x modulo the M. (x mod M). The result, right or wrong is displayed and it is added to the log in the result tab which also includes the time it took to do this mental calculation, so you can see if you improve your mental performance.

Have fun.
In case you still have questions then please use the feedback form on this website.


Rate this page

Click on the stars below to rate this page

Low
High


Corrections:
2-Nov-2019 Vs 1.1 Redesign GUI and added modulo 12 check as well
21-Jun-2017 Vs 1.0 The initial release of practice mental modulo math

Practicing Mental Modulo Calculation

This is an application that can help you to better practice mental math. The application has a variety of different applications. It can be used to improve your mental math performance, or it can be used in real-life applications to check the correctness of adding numbers together or multiplying numbers together. Let´s first look at some practical applications.

Adding numbers together:

Let´s say that you add the numbers:
 123+456
and you get:
 579 (123+456=579)
and want to check if this result sounds reasonable. We can with advantage use module 9 to check the validity of the result.
Taking modulus 9 on both sides you get:
 123 mod 9 + 456 mod 9= 579 mod 9
and you get:
 (6+15) mod 9=21 mod 9
which result in
21 mod 9 = 21 mod 9
Since we have the same on both sides of the "=" sign we can say it is likely the result is correct (but not a guarantee).

Multiplying numbers together:

We can use the same techniques for multiplications as we did for additions. E.g. let´s do the multiplication 123*456 and check if the result 56078 is correct.
Taking modulo 9 on both sides you get:
 (123 mod 9)*(456 mod 9)=(56078 mod 9) =>
 (6) * (15)=(26) =>
 90=26.
Repeat taking modulo 9 on both sides you get:
(90 mod 9)=(26 mod 9) or 0=8
which is not the same. The result 56078 is incorrect. The correct number is 56088 and if you repeat the above calculation you get using modulo 9 on both side, you get:
 0=0
which indicates that this appears to be the correct answer. When I say it appears to be right that it is possible to get a false positive. Let´s say that you get the result of 56079 and apply the same repeated use of mod 9 then you also get 0=0 which could indicate a correct calculation but the result 56079 is incorrect. Could you use other modulo checks than modulo 9? Of course, you could use other modululi as well e.g. to use modulo 4 as an example.
Repeating the calculation, you get:
 (123 mod 4)*(456 mod 4)=(56088 mod 4) =>
 (3)*(0)=(0) =>
 0=0
The problem with modulo 4 is that every time you are 4 of the correct result you get a false positive. For modulo 9 it is for every 9 you are off then you get a false positive. Let´s use modulo 23 as another example and use it on our test expression:
 (123 mod 23)*(456 mod 23)=(56088 mod 23) =>
 (8)*(19)=(14) =>
 (152)=(14).
Repeat modulo 23 on both sides you get
 (14)=(14).
Indicating the result is likely to be right.
So why are you often using modulo 9 and not some other modulo? The reason is that there is a shortcut for calculating modulo 9 for a number and particularly when there are more digits in a number it is significantly faster than doing a regular modulo 9 calculation.
The shortcut technic is by adding the individual digits in a number together and then taking modulo 9 of that number, then you will get the same as taking modulo 9 of the original number. E.g.
 56088 mod 9
is the same as:
 (5+6+0+8+8) mod 9 = (27) mod 9 = (2+7) mod 9 = 9 mod 9 = 0.
Since the remaining is 0 the number 56088 is divisible by 9. The ease of doing modulo 9 with this shortcut makes it a prime candidate for using this technic doing math tricks.
Why the taking modulo 9 of the sum of the digits the same as taking modulo 9 of the original number
To answer that we first need to look at The base 10 representation of a number, N can be given by:
 N=an10n+an-110n-1+...+a1101+a0
Knowing that 10 mod 9 = 1, we can write the 10n≡1(mod 9) therefore
 an10n+an-110n-1+...+a1101+a0=an1+an-11+...+a11+a0

Therefore, we have
 N≡an+an-1+...+a1+a0.
This tells us that N is a multiple of 9 only if the sum of its digits is also a multiple of 9. That is the shortcut to use, that by just checking if the sum is a multiple of 9 then the number in question is also a multiple of 9. The sum shortcut is significantly faster than dividing by 9 on the number N itself.

Classic Mental Math Trick

A classic math trick. (see Arthur Benjamin which is the master of mental math at: (https://www.youtube.com/watch?v=1JW9BA57aR8 )
Take a random number let´s say 378 and ask one from the audience to multiply this number by any 3-digit number that comes into his/her mind and write the result down on a piece of paper without telling you the result. The result is a 5 or 6-digit number. Ask the person to circle one non-zero digit of the result and tell you the remaining digits to you. In a split of a second, you can tell which digit the person circles.
Here is how the trick works. The so-called random number 378 is not as you would suspect a random number selected by you, but a number that is divisible by 9. You can add the individual digit 3+7+8=18, where 18 is divisible by 9. Since your number is divisible by 9 then any number you multiply it with, the result will still be divisible by 9. And by giving you all the digits except one digit you can easily add the given digits together and then the missing digit must be the digit that rounds up to the next sum divisible by 9. Lets see it by an example:
Let´s say that the audience chooses the number 527 and multiplies it with the given number 378 you get 199206. Let´s say that the audience chooses 2 as the digit they circle and then calls out the other numbers 1,9, 9, 0, 6. Adding them quickly together in your head you get:  1+9+9+0+6=25. (notice that the audience can call out the digits in any random order (commutative law for additional). The result will still be the same.
The next higher number from 25 that is divisible by 9 is 27 so the missing digit is 2, to the surprise of the audience when you announce it.
You can spice out the trick by choosing a 4-digit number instead of a 3-digit number or let the audience select the first 2 digits e.g. 5 and 6 and then you can select the third digit that makes the initial number divisible with 9 which in this case is 7 for the number 567. Lastly, the number to be circled mustn´s not be a zero. A zero will introduce an ambiguity if the sum of the other digits is a multiple of 9 since we can´t tell if the missing digit is a 0 or a 9.

Shortcuts for mental modulo calculations

Now since this application is a practice tool for modulo calculation it is good to know some mental shortcuts for the calculation:

ModuloHow to do it
2It is enough just to look at the last digit and apply the modulo calculation on this single digit regardless of how many digits there are in the number. E.g. 123457 mod 2 is the same as 7 mod 2=1.
3 You can use the same shortcuts as for 9 by just adding the individual digits together and then applying mod 3 of that number. E.g., 1234567 mod 3 = (1+2+3+4+5+6+7) mod 3 = 28 mod 3 = 1.
4You need to look at the last 2 digits and apply the modulo of that number. E.g. 1234567 mod 4 is the same as 67 mod 4=3
5You only need to look at the last digit to determine the modulo of that number. E.g. 1234567 mod 5 is the same as 7 mod 5 =2
6There is no good shortcut. However, you can do a running calculation as follows by looking at 1 or 2 digits at a time starting from the left side. Using our test number 1234567, the first 2 digits are 12 which is divisible by 6 so you simply ignore it. The next two are 34%6=4. 4 is now the first digit and the next digit is 5 so 45%6=3 the next pair is then 36%6=0 so ignore it and the last digit is 7%6=1 so the result is 1. After some practice, you can usually do 3-digits at a time e.g.
1234567%6. 123%6=3, 345%6=3, 367%6=1
7Like for 6, there is no good shortcut. However, you can do a running calculation as follows using the same technic as for the digit 6.
1234567%7. Take the first 2 digit 12%7=5 the next to is 53%7=4, the next two digits is 44%7=2, the next 25%7=4, 46%7=4 and the last two digits is 47%7=5
8You need to look at the last 3 digits of the number and take modulo 8 of that number. E.g. 1234567 mod 8 is the same as 567 mod 8=7. Notice a pattern here: for 2 you look at the last digit. For 4 the last 2 digits and for 8 the last 3 digits. It can be shown that for the modulo of a number on the form 2n it is enough to look at the last n digit to quickly calculate the modulo 2n operation. Alternatively, if the number is divisible by both 2 & 4 then it is also divisible with 8
9As previously mentioned the shortcut for 9 is just adding the individual digits together and then applying mod 9 of that number. E.g., 1234567 mod 9 = (1+2+3+4+5+6+7) mod 9 = 28 mod 9 = 1
10This is as simple as it gets. Just look at the last digit and that is the result of mod 10. E.g. 1234567 mod 10 = 7
11Here it gets a little bit trickier but still doable. Starting with the digit to the right you alternate between adding and subtracting digits. An Example will clarify it e.g. 1234567 mod 11 = (7-6+5-4+3-2+1) = 4 which is the result of doing 1234567 mod 11. If you end up with a negative number simply add 11 to the result and you are done. E.g. 123456%7=(-6+5-4+3-2+1)=-3. Since it is negative then continue to add +11 until it becomes positive -3=11=8 which is the result
12It is divisible by 3 and 4

For more division rules see Wikipedia: Division rules

Have fun