# Please help me solve this number theory question. [closed]

For what values of K is 8k + 1 = a² Where a is an integer.

## closed as off-topic by Dietrich Burde, YuiTo Cheng, Davide Giraudo, Paul Frost, Ernie060May 2 at 17:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – Dietrich Burde, YuiTo Cheng, Davide Giraudo, Paul Frost, Ernie060
If this question can be reworded to fit the rules in the help center, please edit the question.

• Your question is phrased as an isolated problem, without any further information or context. This does not match many users' quality standards, so it may attract downvotes, or be put on hold. To prevent that, please edit the question. This will help you recognise and resolve the issues. Concretely: please provide context, and include your work and thoughts on the problem. These changes can help in formulating more appropriate answers. – Brian May 2 at 14:47
• Triangular numbers: $1,3,6,10,15$ and so on – crskhr May 2 at 14:47
• It is unclear how you want to use $p$-adic numbers. The sequence $s_n = n^2\bmod k$ is $k$-periodic, it is not hard to find $\{ n\in \Bbb{Z}, n^2 \equiv b \bmod k\}$. – reuns May 2 at 14:52

Since $$8k+1 = a^2$$, clearly $$a$$ has to be odd, i.e $$a = 2j+1$$. Then $$a^2 = 4j^2 + 4j + 1 = 4j(j+1) + 1$$. As one of $$j, j+1$$ must be even, we can rewrite this as $$a^2 = 8 (j(j+1)/2) + 1$$. Hence $$k = j(j+1)/2$$; i.e $$k$$ must be a triangular number - 1, 3, 6, 10, 15, ....
• And conversely, if $k$ is a triangular number, then $8k+1$ is a perfect square, see here. – Dietrich Burde May 2 at 14:52
$$8k + 1 = a^2, a,k \in \mathbb{Z}$$
$$\iff a \text{ odd}$$ $$\iff a = 2m + 1, m \in \mathbb{Z}$$ $$\iff a^2 = 4m^2 + 4m + 1 = 4m(m+ 1) + 1 = 8k + 1$$ $$\iff 8k = 4m(m+1)$$ $$\iff k = \frac{1}{2}m(m+1)$$
And so $$k$$ has the form of triangular numbers including zero: $$0,1,3,6,10 \dots$$
This proof shows that the implication goes both ways. $$8k + 1 = a^2$$ implies $$k$$ triangular, and $$k$$ triangular implies that $$8k + 1$$ is a perfect square..