## Square Search

#### Problem

Given that `p` is prime, when is 8`p`+1 square?

#### Solution

Let 8`p` + 1 = `k`^{2}. As LHS is odd, `k` must be odd; let `k` = 2`m` + 1.

Therefore 8`p` + 1 = 4`m`^{2} + 4`m` + 1, leading to 2`p` = `m`^{2} + `m` = `m`(`m` + 1).

As `m` and `m` + 1 are consecutive integers, one of them must be even. However, after dividing through by 2 we can see that LHS is prime, so RHS must be prime. This can only happen when `m` = 2; that is, `p` = 3.

Hence 8`p` + 1 can only be square when `p` = 3.

Related problem:

Triangle Search: When is 8`p`+1 a triangle number?

Problem ID: 231 (10 Jul 2005) Difficulty: 3 Star