## Triangle Search

#### Problem

Given that `p` is prime, when is 8`p`+1 a triangle number?

#### Solution

Let 8`p` + 1 = `k`(`k` + 1)/2, so 16`p` + 2 = `k`(`k` + 1)

Therefore 16`p` = `k`^{2} + `k` 2 = (`k` 1)(`k` + 2).

If `k` 1 is odd, then `k` + 2 will be even, and vice versa. In other words, only one of these factors is even, and so it must be a multiple of 16.

As `k` 1 and `k` + 2 differ by 3, we can write 16`p` = 16`m`(16`m` 3), leading to `p` = `m`(16`m` 3).

Clearly `m` = 1, otherwise we would be dealing with a composite number, and `p` = 13 or `p` = 19.

When `p` = 13, 8`p` + 1 = 105 = `t`_{14} and when `p` = 19, 8`p` + 1 = 153 = `t`_{17}.

Related problem:

Square Search: When is 8`p`+1 square?

Problem ID: 234 (31 Jul 2005) Difficulty: 3 Star