Given that p is prime, when is 8p+1 square?
Let 8p + 1 = k2. As LHS is odd, k must be odd; let k = 2m + 1.
Therefore 8p + 1 = 4m2 + 4m + 1, leading to 2p = m2 + 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 8p + 1 can only be square when p = 3.
Triangle Search: When is 8p+1 a triangle number?