# Solution to equation $4n+1 = (2k+1)^2-(2u)^2$ over the natural numbers(!)

Let $n \in \mathbb{N}$ be given, then I want to know if there are $k ,u \in \mathbb{N}$ (with $k \neq n, u \neq n$) such that $4n+1 = (2k+1)^2-(2u)^2$ holds. What makes it difficult for me is the fact that I am looking for solutions over the natural numbers. Otherwise one would see that there are infinitely many solutions (for example by completing the square).

• Can you find an $n$ satisfying $$n = (k+u)(k-u) +2k$$ this looks nicer to my untrained eye! – Chinny84 Aug 9 '15 at 0:02

A solution exists iff $4n+1$ is composite and not the square of a prime.

Factor the right side as $a\cdot b$ where $$a=2(k-u)+1,\ \ b=2(k+u)+1.$$ Since $ab>0$ we have $a>0$ so $k\ge u;$ however $k=u$ leads to $4n+1=b=4k+1$ which is the excluded case $k=n.$ Now since $a,b$ are odd [with $a<b$ since $u\ge 1$] we can rule out $4n+1$ being the square of a prime. Or being a prime for that matter, since at this point $a \ge 3$ and $a<b.$

Now a subtraction gives $b-a=4u,$ so for later we can put $u=(b-a)/4$ toward recovering $u,k.$ Addition gives $b+a=4k+2,$ and in this putting $b=a+4u$ leads to $a+2u=2k+1,$ or with our above $u=(b-a)/4,$ we can solve for $k.$ In sum, $$k=(1/4)(a+b-2), \ \ u=(1/4)(b-a). \tag{*}$$

To apply the above, we start with a composite number $4n+1$ which is not the square of a prime, write it as $ab$ with $1<a<b,$ and use formulas $*$ to find values for $k,u.$ Note that if one tries it on the square of a prime, one either must use $a=1$ which doesn't work as noted, or else one must use $a=b$ which gives $u=0$ which is also to be ruled out, provided $0$ is not considered a natural number.

Note: Since $ab$ is 1 mod 4, and both are odd, we automatically have $a=b$ mod 4, so that $u=(b-a)/4$ is a positive integer provided $a<b.$ Since each is odd and they are equal mod 4, one can also show that $(a+b-2)/4$ is an integer in equations $*.$

Given

$$4 n + 1 = \Big( 2 k + 1 \Big)^2 - \Big( 2 u \Big)^2.$$

Set

$$k = u + a,$$

then we get

$$n = a^2 + a + \big( 2 a + 1 ) u.$$

The case $a=0$ is the solution

$$n = u = k,$$

which is to be excluded.

For every $a > 0$ we have a linear relation between $n$ and $u$.

$$\begin{array}{l|ll} a & n\\ \hline 1 & 2 + 3u\\ 2 & 6 + 5u\\ 3 & 12 + 7u\\ 4 & 20 + 9u & = 2 + 9(u + 2)\\ 5 & 30 + 11u\\ 6 & 42 + 13u\\ 7 & 56 + 15u & = 2 + 3 ( 5 u + 18 ) = 6 + 5(3 u + 10)\\ \vdots & \vdots \end{array}$$

The equation is not general solvable for a given $n$.

In case $n$ is even, we can find solutions for:

$$n = 8, 14, 16, 20, 26 (3\times),32, 36, 38 (2\times),40, 44, 46, 50, 52, 54, 56 (3\times),62,\\ 66, 68 (2\times),74 (2\times),76, 82, 86 (2\times),92, 94, 96 (3\times), \cdots$$

For example

$$\begin{eqnarray} 4 \times 26 + 1 &=& \big( 2 \times 9 + 1 \big)^2 - \big( 2 \times 8 \big)^2\\ &=& \big( 2 \times 6 + 1 \big)^2 - \big( 2 \times 4 \big)^2\\ &=& \big( 2 \times 5 + 1 \big)^2 - \big( 2 \times 2 \big)^2 \end{eqnarray}$$