![]() |
VOOZH | about |
Checking for a large number whether it is prime or not can be difficult. This is so difficult that RSA algorithm uses this fact to encrypt data on Internet. However there are certain trick that we can use. The idea is reduce the number faster using divisibility rules.
1. If the given number has 0s as at the end, the number is divisible by 10. So it is not a prime.
2. If the last digit is 5, we know the number is divisible by 5. So not prime
3. A number is divisible by 3 if sum of digits is divisible by 3. For example 122211 is divisible by 3 because sum of digits is 9 (divisible by 3).
3. A prime factor of a number cannot more than square root of the number. So we need to check only numbers less than or equal to square root. For example for 13, we do not need to check beyond 3 for divisibility and we can declare it as prime after checking with 3.
4. To check divisibility by 11, if the difference between the sum of its odd-positioned digits and its even-positioned digits is 0 or a multiple of 11. For example 121, the difference between sum of alternating digits is (1 + 1) – 2 = 0. 0 is divisible by 11
5. To check divisibility by 7, double the last digit and subtract it from the rest of the number and if we get a number which is divisible by 7, then the whole number is divisible by 7.