News for hackers. Stuff that matters.
Re:Quick - is 91 prime? by cstejerean on Wednesday March 12, 2008 @12:41PM (#135235)
For 11 there is an easier trick (or at least it's easier in that you can perform it in your head faster).

Starting from the left add every other digit => n1, Starting with the second digit add every other digit => n2

if n1 - n2 == 0 or if n1 - n2 is divisible by 11 then the number is divisible by 11. Example

13574

1 + 5 + 4 = 10

3 + 7 = 10

Since 10 - 10 == 0, the number is divisible by 11.

Even cooler example 155357548018579643

1 + 5 + 5 + 5 + 8 + 1 + 5 + 9 + 4 = 43

5 + 3 + 7 + 4 + 0 + 8 + 7 + 6 + 3 = 43

43 - 43 == 0, also divisible by 11

Re:Quick - is 91 prime? by aston on Wednesday March 12, 2008 @08:26PM (#135620)
n1 - n2 == 0 or if n1 - n2 is divisible by 11

aka

if n1 = n2 (mod 11)

Cool trick.