## Prime number trick (with solution)

Using prime numbers, you can amaze your friends with a prime prediction…

1. Ask your friends to pick any prime number greater than 3.
2. Square it.
4. Divide by 12.

Without knowing which prime number your friends picked, you can still tell them:
There will be a remainder of 3.
But HOW does it work?
Let’s do an example:
13 is a prime number, squaring it gives 169, adding 14 gives 183 which has a remainder of 3 upon division by 12.

This works for every prime number greater than 3, but how exactly does it work?

The mathematics behind this is rather simple.
1. Let p be a prime number, p > 3.
2. Squaring gives:
p^2.
p^2 + 14
4. Taking it modulo 12 gives:
(p^2 + 14) mod 12

We want to show that:
(p^2 + 14) mod 12 = 3
This is equivalent to:
p^2 – 1 is divisible by 12.
That is:
(p-1)(p+1) is divisible by 12.

For a number to be divisible by twelve, it has to be divisible both by 3 and by 4. We know that, out of p-1, p and p+1, one of them must be
divisible by 3; and it can’t be p, because p is prime and greater than 3. Thus, either p-1 or p+1 is divisible by 3, and so their product is also:
(p-1)(p+1) is divisible by 3.

Now, since p is a prime greater than 3, we know that it is odd. Therefore, both p-1 and p+1 are even numbers. The product of two even numbers is divisible by 4, so:
(p-1)(p+1) is divisible by 4.

Combining this with the above, we get that:
(p-1)(p+1) is divisible by 12.
And hence:
(p^2 + 14) mod 12 = 3

** Note: Some posts on Math-Fail are user-submitted and NOT verified by the admin of the site before publication. If you find this post to be distasteful, non-math related, ?or something worse?, then definitely leave a comment letting me know. Thanks very much! Mike **     (4.20 from 5 votes) Loading...

1. ARobinson

That explanation does not explain why it has to be plus 14 and not plus 15 or plus 13 or any other number.
And don’t you mean (p^2 + 14) mod 12 congruent 3 and not (p^2 + 14) mod 12 equals 3? 1 1

2. Vedran

Because from
p²-1 ≡ 0 (mod 12)
follows that
p²-1+12 ≡ 0 (mod 12)
and
p²-1+12+3 ≡ 3 (mod 12)
p²+14 ≡ 3 (mod 12)
It doesn’t really have to be fourteen, we could further add any multiple of twelve. For instance:
p²+14 ≡ p²+2 ≡ p²+158 ≡ p²-10 ≡ 3 (mod 12) 2 0

3. Harish Raj

What about 221?  2 0
4. im confused 0 0