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.
3. Add 14.
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.
3. Adding 14 gives:
    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 **

1 Star2 Stars3 Stars4 Stars5 Stars (4.20 from 5 votes)
Loading...Loading...

4 Comments.

  1. 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?

    Thumb up 1 Thumb down 1

  2. 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)

    Thumb up 2 Thumb down 0

  3. What about 221? :mrgreen:

    According to your idea,
    square it 221^2=48841
    add 14 to it => 48841+14=48855
    divide it by 12 => 48855/12 gives me the reminder 3.

    But 221 is divisible by 13. 😆

    Thumb up 2 Thumb down 0

  4. 😳 how do you get this 😳 👿 👿 👿 👿 👿 👿 👿 👿 👿 👿 👿

    Thumb up 0 Thumb down 0