News for hackers. Stuff that matters.
Re:Divisibility by 7 by brianbreslin on Saturday October 30, 2010 @11:21PM (#1852396)
Clever but most people won't remember these tricks. I for one would appreciate a refresher on the other divisibility rules/tricks.
Re:Divisibility by 7 by spicyj on Saturday October 30, 2010 @11:40PM (#1852425)
I do math contests competitively, so I remember these things. Here are some rules:

Divisibility by 2: Last digit is divisible by 2 (0, 2, 4, 6, or 8).

Divisibility by 3: Sum of digits is divisible by 3. (You can repeatedly sum the digits until the sum is small enough to manage easily.)

Divisibility by 4: Last two digits are divisible by 4 (00, 04, 08, 12, ...). If you don't know your multiples of four, you can divide the two digits by 2 and then see if it's even.

Divisibility by 5: Last digit is divisible by 5 (0 or 5).

Divisibility by 6: Divisible by 2 and by 3. (Works similarly for all composite numbers, of course. Like 10, 14, 15, etc. Make sure the factors you're checking are relatively prime (share no common factors), or it won't work. For example, divisibility by 2 and 6 does not imply divisibility by 12.)

Divisibility by 8: Last three digits are divisible by 8 (000, 008, 016, ...). Probably faster to divide the last three by 2 at least once then check divisibility by 4.

Divisibility by 9: Sum of digits is divisible by 9. (You can repeatedly sum the digits until the sum is small enough to manage easily.)

Divisibility by 11: Alternating sum of digits is divisible by 11. (Almost always turns out to be -11, 0, or 11. Example: 66374. 6 - 6 + 3 - 7 + 4 = 0, so 66374 is divisible by 11.)

Re:Divisibility by 7 by omaranto on Sunday October 31, 2010 @02:29AM (#1852649)
Seeing this list of silly things one might find useful in high school math contests made me nostalgic for those days...
Re:Divisibility by 7 by jacquesm on Sunday October 31, 2010 @06:22AM (#1853003)
They're not that silly actually.

Division is the most 'complicated' of the arithmetic operations and if you rely on doing sums in your head frequently then knowing such shortcuts can speed up the calculations considerably.

It also helps in checking results of other calculations.

Re:Divisibility by 7 by Panoramix on Sunday October 31, 2010 @08:56AM (#1853182)
I find this kind of things extremely handy in my everyday job. Especially in meetings, since often you are forced to do mental arithmetic to estimate the magnitude of a parameter, etc. Abusing the calculator can put your brain in poor shape, just like muscles!
Re:Divisibility by 7 by omaranto on Wednesday November 03, 2010 @09:54AM (#1864761)
Seriously? You use divisibility tests to make estimations? I hope nothing much is riding on those estimates...
Re:Divisibility by 7 by xyzzyz on Sunday October 31, 2010 @07:37AM (#1853091)
Silly? Some people do math for a living.
Re:Divisibility by 7 by omaranto on Wednesday November 03, 2010 @09:52AM (#1864755)
I do math for a living. Needing to now whether a small integer is divisible by 7 rarely comes up. And when it dos we tend to let dumb machines handle the easy stuff, leaving humans free to think.
Re:Divisibility by 7 by alextgordon on Sunday October 31, 2010 @08:22AM (#1853146)
Those people don't get paid by the hour, so they use a calculator :)
Re:Divisibility by 7 by kijinbear on Sunday October 31, 2010 @01:54AM (#1852586)
> relatively prime

Do primes come in degrees these days?

Re:Divisibility by 7 by sid0 on Sunday October 31, 2010 @02:02AM (#1852602)
I'm not sure if this is humour or not, but "relatively prime" or "coprime" means that the two numbers have GCD 1.
Re:Divisibility by 7 by jackowayed on Saturday October 30, 2010 @11:32PM (#1852415)
I know:

* 2 - if it ends in 0,2,4,6,8, it's divisible by 2

* 3 - if the sum of the digits is divisible by 3, so is the number

* 4 - Ignore everything but the last 2 digits. If the last 2 digits make a number that's divisible by 4, the whole number is (eg. anything ending in 52 is divisible by 4 because 52 is divisible by 4)

* 5 - If it ends in 0 or 5, it's divisible by 5.

* 6 - do an and of the 2 and 3 tests.

* 8 - Same as the 4 test, only last 3 digits.

* 9 - same as 3, only the digit sum needs to be divisible by 9 instead of 3

* 10 - If it ends in 0, it's divisible by 10.

So I guess the only one I don't know is 11.

Re:Divisibility by 7 by skmurphy on Sunday October 31, 2010 @12:25AM (#1852478)
11 = add the first, third, fifth, etc.. digits, if the sum matches that for the second, fourth, sixth, etc.. then the number is divisible by 11.
Re:Divisibility by 7 by TheNewAndy on Sunday October 31, 2010 @01:48AM (#1852575)
Not quite:

5060 is an exception to your rule.

As described before, if (even digit sum) - (odd digit sum) is divisible by 11, then the number is divisible by 11.

Re:Divisibility by 7 by skmurphy on Sunday October 31, 2010 @01:59AM (#1852594)
If you are not careful you will learn something new. Thanks for the tip.
Re:Divisibility by 7 by senki on Sunday October 31, 2010 @05:27AM (#1852927)
The Wikipedia has a good article:

http://en.wikipedia.org/wiki/Divisibility_rule

Re:Divisibility by 7 by anorwell on Saturday October 30, 2010 @11:47PM (#1852434)
Re:Divisibility by 7 by ramidarigaz on Saturday October 30, 2010 @11:32PM (#1852413)
If the last two digits are divisible by four, the entire number is divisible by four. For instance: 62857724. 24 is divisible by four, so the whole thing is.