# What are the nonegative integral solutions to $k^2 = 2 n^2 +1$?

What are the nonegative integral solutions to $k^2 = 2 n^2 +1$? $n = 2$ and $k = 3$ works, what is the next smallest pair?

• Can you give some context to your question - why do you need to know, what have you tried etc Commented Oct 22, 2014 at 15:05
• This question ultimately boils down to determining triangular numbers that are also perfect squares. Commented Oct 22, 2014 at 16:03
• Why? To answer to a question posed by Will Shortz (puzzle master of NY Times), originally by Martin Gardner, on Sunday, October 19 AM. Commented Oct 22, 2014 at 17:18

First, take the square root of both:

$$\sqrt{k^2}=\sqrt{2n^2+1} \iff |k| = \sqrt{2n^2+1}$$. In order to get both variables to positive integers, you need to have $$2n^2+1$$ to be a square number:

If $$n = 1 \iff 2n^2+1 = 3$$ and is no square number:

$$n = 1 \iff 2n^2+1 = 3$$

$$\color{blue}{n = 2 \iff 2n^2+1 = 9} \rightarrow$$ which is a square number

$$n = 3 \iff 2n^2+1 = 19$$

$$n = 4 \iff 2n^2+1 = 33$$

$$n = 5 \iff 2n^2+1 = 51$$

$$n = 6 \iff 2n^2+1 = 73$$

$$n = 7 \iff 2n^2+1 = 99$$

$$n = 8 \iff 2n^2+1 = 129$$

$$n = 9 \iff 2n^2+1 = 163$$

$$n = 10 \iff 2n^2+1 = 201$$

$$n = 11 \iff 2n^2+1 = 243$$

$$\color{blue}{n = 12 \iff 2n^2+1 = 289} \rightarrow$$ which is also a square number

So, the second value for $$n = 12$$ and $$k=\sqrt{2n^2+1}=\sqrt{289}=17$$.

• Are there infinitely many solutions? Are they quite rare? Commented Oct 22, 2014 at 17:15