TITLE: Divisibility criteria for $7,11,13,17,19$
QUESTION [19 upvotes]: A number is divisible by $2$ if it ends in $0,2,4,6,8$. It is divisible by $3$ if sum of ciphers is divisible by $3$. It is divisible by $5$ if it ends $0$ or $5$. These are simple criteria for divisibility.
I am interested in simple criteria for divisibility by $7,11,13,17,19$.

REPLY [4 votes]: Let $n=\text{'abcdef'}=10^5a+10^4b+10^3c+10^2d+10e+f$. Using modular arithmetic,
$$n\equiv 5a+4b+6c+2d+3e+f\mod 7.$$
As $10^6\bmod7=1$, this repeats for the next groups of $6$ digits.
To get smaller coefficients, you can reduce some of them by $-7$, giving
$$n\equiv (f-c)+2(d-a)+3(e-b)\mod 7.$$
For instance
$$123456\equiv (6-3)+2(4-1)+3(5-2)\equiv18\mod7$$ isn't divisible by $7$.
You can generalize the method to other divisors.