Solving $(n+1)(n+2)…(n+k)−k = x^2$

Let $n$ and $k$ be positive integers.

Need to find all pairs of $(n,k)$ such that

$$(n+1)(n+2) \cdots (n+k)−k = x^2,$$

where $x^2$ is a perfect square.


Solution 1:

Note: This answer is not mine. It is taken from here. I write it just for completeness and because I have been asked to do it.

Suppose that $k>5$ is composite. Then, it is well known that $k|(k-1)!$. Also, $$k!|(n+1)(n+2) \cdots (n+k),$$ so let $$(n+1)(n+2) \cdots (n+k) = k!t.$$ Then, $k((k-1)!t-1)$ is a perfect square. Since $\text{gcd}(k,(k-1)!t-1) = 1$, therefore, both those numbers must be perfect squares. Let $$(k-1)!t-1 = x^2.$$ Then, $$x^2+1 = (k-1)!t$$ can have no prime factor which is $3\pmod{4}$. So, $k-1 < 3 \implies k \le 3$, contradicting our assumption that $k$ is composite.

If $k=4$ we must have that $(n^2+5n+5)^2 - 5$ is a perfect square, contradiction.

If $k$ is prime, suppose that $k \ge 5$. Let the perfect square in question be $x^2$. Then $$8|5!|k!|(n+1)(n+2) \cdots (n+k),$$ and therefore $$x^2 \equiv -k \pmod{8}.$$ Since $k$ is odd, and any odd square is $1 \pmod{8}$, so $k \equiv 7 \pmod{8}$. Then, $$k-1 = 8m+6 = 2(4m+3),$$ has some prime factor of the form $3 \pmod{4}$. Let this prime be $q$. Then $$q|k!|(n+1)(n+2) \cdots (n+k),$$ so $x^2 \equiv -k \equiv -1 \pmod{q}$, contradicting the fact that $\left( \frac{-1}{q} \right) = -1$.

We are left with the cases $k=1,2,3$. For $k = 1$, $n$ perfect square is a trivial solution. For $k=2$, $n^2+3n$, must be a perfect square. But $$(n+1)^2 < n^2+3n < (n+2)^2$$ for $n > 1$. $n = 1$ is however, a solution. For $k = 3$, $$(n+1)(n+2)(n+3) = x^2+3.$$ At least one of the $3$ terms on the $\text{LHS}$ is $2 \pmod{3}$ and has a $2 \pmod{3}$ prime factor. Suppose that this prime $q \neq $. Then, $q|x^2+3$, is a contradiction since $\left( \frac{-3}{q} \right) = -1$. Otherwise, all $2 \pmod{3}$ prime factors of the LHS are $2$. If $n$ is odd, then $$8|(n+1)(n+3)|x^2+3,$$ contradiction. So $n$ is even and therefore, we can only have $n+2 \equiv 2 \pmod{3}$. Also, since $2^2||x^2+3$, so $v_2(n+2) = 2$. Then, $(n+2)/4 \equiv 2 \pmod{3}$ is odd and therefore, the $\text{LHS}$ does have a $2 \pmod{3}$ factor, contradiction.