Composites - A number is divisible by a given divisor if it is divisible by the highest power of each of its prime factors. For example, to determine divisibility by 36, check divisibility by 4 and by 9. Note that checking 3 and 12, or 2 and 18, would not be sufficient.
Primes - We can form divisibility rules for primes >=13 by the following method.
Suppose we want to find divisibility rule for 13, then we form equation as: 3x + 1 = 13, solving for x gives us x = 4 and we must multiply x with unit digit and sum to the remaining number and check divisibility again by 13.
Suppose we want to find divisibility rule for 17, then we form equation as: 7x + 1 = 17, solving for x gives us x = 16/7 (floor of it is 2) and we must multiply x with unit digit and subtract from the remaining number and check divisibility again by 17.
//Formula
sum = n + 2n + 3n + 4n + 5n ...
sum => n (1 + 2 + 3 + 4 + 5 ...)
sum => (n/2) * (n(n+1)/2)
sumR = (n / 2) * (R/n) * ((R/n)+1)
sumL as (n / 2) * ((L-1)/n) * ((L-1/n)+1)