# Fun With Numbers - Divisibility Tests

I got a bit lost on YouTube, via Chinese Remainder Theorem and Modular Functions, I ended up with divisibility tests.
Telling by eye whether a number divides by 2, 3, 4, 5, 6, 8, 9 or 10 is pretty straight forward, non-prime numbers like 12 or 15 are also easy enough, you just have to do two tests; if it divides by 3 and by 4, then it must divide by 12 and so on.
There is a neat way of checking whether a long number divides by a prime number, short of actually doing long division. I have no idea what practical purpose this serves, it's just a bit of Fun With Numbers.
You just have to remember the "magic numbers" in this table:
1,-0......11,-1.....21 n/a.....31,-3
3,+1.....13,+4....23,+7..... 33 n/a
7,-2......17,-5.....27 n/a.....37,-11
9,+1.....19,+2....29,+3..... 39 n/a
(21, 33 and 39 are not prime numbers, but for completeness, the entries would be 21,-2; 33,+10; and 39,+4.)
If you can remember the first column, the "magic number" for the prime numbers go up/down by -1 or +1 for numbers ending in 1 or 9, and by +3 or -3 for numbers ending in 3 or 7. So you can reconstruct the whole table just with those two rules, and it goes on forever AFAIAA, so the "magic number" for 73 would be +21. There's no such thing as -0 of course, that's just to help you remember the pattern.
What do we do with the "magic number"?
If you have to work out whether a large number divides by a particular prime, you proceed as follows:
1. Multiply the last digit by the "magic number" and add that to the remaining digits (i.e. subtract it if the "magic number" is negative, or add it if both the "magic number" and the last digit were negative).
2. Do the over and over again until either:
a) you get to zero or a number that divides by the prime you are testing for (pass); or
b) you end up with a number that clearly doesn't divide by the prime you are testing for or the calculation goes circular and starts flipping between positive and negative (fail).
Let's test if 169,682 divides by 37:
16,968 - (11 x 2) = 16,946
1,694 - (11 x 6) = 1,628
162 - (11 x 8) = 74
If it's not obvious to you that 74 = 37 x 2, then keep going...
7 - (11 x 4) = -37
-37 clearly divides by 37, that's a pass.
Let's test if 169,680 divides by 37 (it clearly doesn't):
16,968 - (11 x 0) = 16,968
1,696 - (11 x 8) = 1,608
160 - (11 - 8) = 72
Clearly a fail, but let's keep going...
7 - (11 x 2) = -15
-1 - (11 x -15) = 164
16 - (11 x 4) = -28
-2 - (11 x -8) = 86
At this stage you are flipping from positive to negative, so we can declare this a fail.

You Might Also Like :

• ## Big Food Giants Manipulate Public Health Policy in China

Coca-Cola is at it again. As soda sales decline in the United States and Europe, beverage companies look to emerging economies like China for growth. And, it... Read more

By  Dietdoctor
DIET & WEIGHT, HEALTH, HEALTHY LIVING, MEDICINE
• ## Jewellery for a Precious You

Jewellery is always close to a woman’s heart. It completes her look and boost confidence. Considering the changing trends in jewellery fashion, it becomes... Read more

By  Dr.jenifer Sayyed
LIFESTYLE
• ## Rajshri Productions’ Next Is A Film On Friendship | Hum Chaar | Trailer

Abhishek Dixit’s debut feature film Hum Chaar is a Bollywood film made under the banner of Rajshri’s film. Hum Chaar is written and directed by Abhishek Dixit. Read more

By  Themoviean
ENTERTAINMENT, MOVIES
• ## Saint Paul the First Hermit

Today is the feast day of Saint Paul the hermit. This is a sweet and delicate Oatmeal Bread topped with rolled oats and naturally sweetened with agave. Saint... Read more

By  Veronica46
FOOD & DRINK, RECIPES
• ## Irupathiyonnaam Noottaandu | Teaser | Pranav Mohanlal | Arun Gopy

Arun Gopy’s Irupathiyonnaam Noottaandu is an upcoming Malayalam action-drama feature film starring Pranav Mohanlal and Zaya David in the lead roles. Read more

By  Themoviean
ENTERTAINMENT, MOVIES
• ## A Year Of Body Positivity

Last January, as I sat there on New Years eve all set to make the same old resolutions I've made year after year for as long as I can remember, I realised how... Read more

By  Sparklesandstretchmarks
DIARIES, SELF EXPRESSION
• ## Garden Bloggers Bloom Day – Jan 2019

Euphorbia rigidaWhen I went out to take the photos for this blog post I was surprised at how much was in flower dotted around the garden. Read more

By  Patientgardener
GARDENING, HOME