Interesting thought this morning. It started with: is 509 prime? So I started doing trial division. Dividing by 13 I found
Now moving on to 17, I can quit immediately *without* dividing because I just saw that
Another handy trick is, when checking if 509 is a multiple of 19, you do *not* start by dividing 509 by 19 getting 380 plus some yucky remainder. Instead you observe that 509 = 19 + 490 and 49 is not a multiple of 19 so you move on.
I only thought of this embarrassingly late in life.
An elaboration on this is that when factoring smallish numbers of the form
For example, instead of dividing
I'm talking about mental calculation here, or maybe abacus. For computer calculation it's obviously stupid.
The overarching trick here is (a) "short division" and (b) short division is usually taught left to right, but it works just as well right to left and you should use the one that seems easier.
To do
But to do
My kids' schools never taught them short division, which seems to me a sad and odd omission.
The idea is that instead of doing the big hairy thing on the left you do the compact speedy thing on the right. The left-side technique should only be used when the divisor is bigger than the multiplication tables you have memorized.
The thing on the right is simple enough to do in your head, and particularly so if you only need the remainder and not the quotient. My kids were often mystified by my ability to divide in my head but it's just that I was taught a better algorithm than they were.
I blogged about this a while back as part of a longer article about several methods of checking for divisibility by 7: https://blog.plover.com/math/divisibility-by-7.html
@mjd Alternatively, 1001 is (7)(11)(13), so 5031 is (031-5)=26 (mod 1001), so it's a multiple of 13.
@icecolbeveridge I really need to start doing this, thanks.
@mjd ~~there's [edit: was, now fixed] some mistake in the image on the right -- it starts 1764... Instead of 1763...~~
@svat Yes, for 6 years I have been too lazy to correct the picture, because the article is about divisibility testing, and the wrong quotient doesn't affect that.
@mjd It's not just about the quotient — I had never encountered the term "short division" before (we were only taught "division" which is closer to the picture on the left, but in practice I was doing something more or less like the picture on the right) so I was trying to understand "short division" using the picture, so I didn't understand how you got the 4 or the final 9 in the quotient, or even the remainder of 9 instead of 2 (which is equivalent yes but it was confusing). Now I understand what was intended though :)
@svat Yes, I really should fix it, it detracts from the article.
@svat Fixed, thanks for the nudge.
@mjd in the UK pupils call this the "bus stop" method and is the one they learn these days. None of my pupils know anything about long division. They see it for the first time when we teach them polynomial division, and they find it really hard.
@mjd Sorry, could you explain what you mean? I'm not sure if you're saying 509 is or isn't a multiple of 17 (I know it isn't, is the logic "it can't be because 390 isn't"?)
@icecolbeveridge Sorry, I answered the wrong question before.
My trial division by
I know that
@mjd ok, good, we're on the same page :-)
@mjd Since 509 mod 4=1, you can check if it's the sum of two squares in one and only one way and then check to see if the two squares are relatively prime.
@jhertzli I don't understand how that helps. Please elaborate.