# Q: Why is it that (if you exclude 2 & 3) the difference between the squares of any two prime numbers is divisible by 12?

Physicist:  That’s a really cool property!

Every prime number (other than 2 and 3) can be written in the form 6j+1 or 6j+5.  For example, 17 = 6(2)+5 and 31 = 6(5)+1.

This is because numbers of the form 6j, 6j+2, 6j+4, are all divisible by 2, and all numbers of the form 6j, 6j+3 are divisible by 3.  So that restricts the options for primes to just the “+1″ set and the “+5″ set.  Not all of the numbers in these sets are primes, but all the primes are in these two sets.

6j = 6, 12, 18, 24, 30, …  All divisible by 6.

6j+1 = 7, 13, 19, 25, 31, …

6j+2 = 8, 14, 20, 26, 32, …  All divisible by 2.

6j+3 = 9, 15, 21, 27, 33, …  All divisible by 3.

6j+4 = 4, 10, 16, 22, 28, 34, …  All divisible by 2.

6j+5 = 5, 11, 17, 23, 29, 35, …

Call the primes p and q, and notice that $p^2-q^2 = (p+q)(p-q)$.

If p and q are both the same type (+1 or +5), then (p-q) will be a multiple of 6.  For example: (+1 case) 31-7 = 24 and (+5 case) 29-11 = 18.

If p and q are opposite types, then (p+q) will be divisible by 6.  For example: 23+13 = 36.

In both cases, the other bubble, (p+q) or (p-q), will always be divisible by 2, since the sum and difference of any two odd numbers is always even. So, one bubble is always a multiple of 6 and the other is always a multiple of 2, and together the whole thing is always a multiple of 12.

For example: p=11, q=7.  $11^2 - 7^2 = (11+7)(11-7) = (18)(4)$  18 is divisible by 6, and 4 is divisible by 2, so 18×4 is divisible by 12!

This is another example of modular arithmetic.  It almost should have been included in the “tricks with 9′s post“.

Also: This trick doesn’t really have much to do with “primes”, so much as it has to do with “numbers that don’t have 2 or 3 as a factor”.  That isn’t obvious at first.  The first composite (not prime and not 1) number with no 2′s or 3′s is 25.

This entry was posted in -- By the Physicist, Brain Teaser, Math, Number Theory. Bookmark the permalink.

### 5 Responses to Q: Why is it that (if you exclude 2 & 3) the difference between the squares of any two prime numbers is divisible by 12?

1. asdfasdf says:

Cute theorem.

I never heard of one calling a factor a “bubble.” T’is a nice idea.

2. Paul says:

I thought bubbles refer to the parentheses with stuff inside…

3. Wonderful! It’s easy to show and I didn’t see the result as obvious (even though I have a BA in math).

4. Amarnath says:

Given that 2^10+5^12 is a product of two primes, find the difference between these two primes? How do I solve this? I need to explain this to my 6th grade child.

Amar

5. http://www.wolframalpha.com/input/?i=FACTOR%282%5E10%2B5%5E12%29 =244141649=14657 X 16657
16657 – 14657 = 2000