-
ChessWriter
- Senior | Next Rank: 100 Posts
- Posts: 54
- Joined: Sun Jan 01, 2012 4:24 am
I came across an interesting way to test whether a number is prime or not. The method can only be used limitedly as I have explained in the last paragraph.
If you are given a prime number(n), then n squared minus 1 is always a multiple of 12
Example. To test 13
Step 1: Square 13 = 169
Step 2: Substract 1 = 169-1 = 168
Step 3: Check if this is a multiple of 12. 168 is indeed a multiple of 12. Therefore 13 is a prime number.
I can myself square even large numbers in my head and divide them by 12. But if you are not able to do so, you can use this method a little differently.
Say you are given a large 6 digit prime number. You cannot first square it, substract 1 and then test it for divisibility by 12. That will take too long. But the method can still be useful because once you've determined the last two digits of a number(the units and the tens digit), then you can test it for divisibility by 4.
If the number is not divisible by 4, then it cannot be divisible by 12 and the number being tested is not a prime number.
I will give an example of this:
Example. To test 113
Step 1: Determine the last two digits you would get on squaring 113. These digits are 69 (if you square 113 you get 12769)
Step 2: Substract 1 = 69-1 = 68
Step 3: Check if this is a multiple of 4. 68 is indeed a multiple of . Therefore you should square 113 completely and test for divisibility by 3.
If you are given a prime number(n), then n squared minus 1 is always a multiple of 12
Example. To test 13
Step 1: Square 13 = 169
Step 2: Substract 1 = 169-1 = 168
Step 3: Check if this is a multiple of 12. 168 is indeed a multiple of 12. Therefore 13 is a prime number.
I can myself square even large numbers in my head and divide them by 12. But if you are not able to do so, you can use this method a little differently.
Say you are given a large 6 digit prime number. You cannot first square it, substract 1 and then test it for divisibility by 12. That will take too long. But the method can still be useful because once you've determined the last two digits of a number(the units and the tens digit), then you can test it for divisibility by 4.
If the number is not divisible by 4, then it cannot be divisible by 12 and the number being tested is not a prime number.
I will give an example of this:
Example. To test 113
Step 1: Determine the last two digits you would get on squaring 113. These digits are 69 (if you square 113 you get 12769)
Step 2: Substract 1 = 69-1 = 68
Step 3: Check if this is a multiple of 4. 68 is indeed a multiple of . Therefore you should square 113 completely and test for divisibility by 3.
Last edited by ChessWriter on Tue Feb 28, 2012 2:34 pm, edited 1 time in total.













