Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Quick - is 91 prime?.
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
aka
if n1 = n2 (mod 11)
Cool trick.
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