divisibility for numbers like 13,17 and 19 - Compartmentalization method For denominators like 13, 17 i often see my professor use a method to test whether a given number is divisible or not. The method is not the following :
Ex for 17 : subtract 5 times the last digit from the original number, the resultant number should be divisible by 17 etc...
The method is similar to divisibility of 11. He calls it as compartmentalization method. Here it goes.
rule For 17 :
take 8 digits at a time(sun of digits at odd places taken 8 at a time - sum of digits at even places taken 8 at a time)
For Ex : $9876543298765432..... 80$digits - test this is divisible by 17 or not.
There will be equal number of groups (of 8 digits taken at a time) at odd and even places. Therefore the given number is divisible by 17- Explanation.
The number 8 above differs based on the denominator he is considering.
I am not able to understand the method and logic both. Kindly clarify.
Also for other numbers like $13$ and $19$, what is the number of digits i should take at a time? In case my question is not clear, please let me know.
 A: You quote two different rules with different results.  When testing for divisibility by 17 by subtracting 5 times the last digit from the orignal number without its last digit, you are using the fact that $51$ is divisible by $17$, so $10a+b \equiv 10a-50b \pmod {17}$,  then the fact that $10(a-5b)$ is a multiple of $17$ if and only if $(a-5b)$ is.  Unless you do further computation, you lose the remainder if the original number is not a multiple.
When you take blocks of 8 digits, you use the fact that $10^8+1 \equiv 0 \pmod {17}$, so $10^8a+b \equiv b-a \pmod {17}$  You retain the remainder in this case.  For 13, you need half the period of its repeating decimal, which is 6, so you use blocks of 3.  Note that $10^3+1=1001 \equiv 0 \pmod {13}$
A: Your professor is using the fact that $100000001=10^8+1$ is divisible by $17$. Given for example your $80$-digit number, you can subtract $98765432\cdot 100000001=9876543298765432$, which will leave zeros in the last $16$ places. Slash the zeros, and repeat. After $5$ times you are left with the number $0$, which is divisible by $17$, and hence your $80$-digit number must also be divisible by $17$.
When checking for divisibility by $17$, you can also subtract multiples of $102=6\cdot 17$ in the same way.
For divisibility by $7$, $11$, or $13$, you can subtract any multiple of the number $1001=7\cdot 11\cdot 13$ without affecting divisibility by these three numbers. For example, $6017-6\cdot 1001=11$, so $6017$ is divisible by $11$, but not by $7$ or $13$.
For divisibility by $19$, you can use the number $1000000001=10^9+1=7\cdot 11\cdot 13\cdot 19\cdot 52579$. By subtracting multiples of this number, you will be left with a number of at most $9$ digits, which you can test for divisibility by $19$ by performing the division.
A: The Similar can also be said for divisibility by $13$
$10^3/13$ gives a remainder of $-1$
$10^6/13$ gievs a remainder of $+1$
So again the rule for $13$, will be same as the rule for $7, 11$.
Group the numbers into triplets as we see alternate changes of $-1$ to $+1$ between 
every three powers of $10$. So the rule for $13$ will also be 
(Sum of triplets at odd places - Sum of triplets at even places)
or 
Sum of digits at odd places taken $3$ at a time - Sum of digits at even places taken three at a time)
As i said, all this can be summarised as:
$10^x/B = +1$ holds for divisors (values of B) like $3,9, 37$ 
$10^x/B = -1$ and $+1$ for divisiors (values of B) like $7, 11, 13, 17$
$10^x/B = 0$ for divisors (values of B) like powers of $2$ and $5$
where $+1,0,-1$ are the remainders of the respective divisions
