5

Find all integers $n$ for which $n^2+n+1$ is a perfect square.

By hit and trial we get $n=-1,0$ but could someone suggest any genuine approach as how to approach this problem?

MathGeek
  • 1,347

7 Answers7

8

Usually, $n^2+n+1$ is between the consecutive squares $n^2$ and $n^2+2n+1=(n+1)^2$

4

Hint: If $n^2+n+1=x^2$ then $4n^2+4n+4=4x^2$ so $(2n+1)^2+3=4x^2$. When do two perfect squares differ by $3$?

André Nicolas
  • 507,029
  • What if it is $n^2+n+41$ instead of $n^2+n+1$? I mean is there any general approach? – MathGeek Jul 12 '16 at 16:52
  • 1
    @MathGeek: For the particular example you mention, same idea. We get $(2n+1)^2 +163=4x^2$. To find squares $u^2$ and $v^2$ that differ by $163$, note that $(u-v)(u+v)=163$. Since $163$ is prime, that gives $u-v=1$, giving $u+v=163$, and $3$ other possibilities. Solve. The same method can be used to solve $u^2-v^2=k$. If $k$ has many factors, there will in general be many solutions. – André Nicolas Jul 12 '16 at 17:01
3

Note that $n^2 + n + 1 = (n+1)^2 - n$. Now if $n > 0$, then $(n+1)^2 > (n+1)^2 - n > n^2$, so the quantity $(n+1)^2 - n$ is stuck between two consecutive squares and thus cannot be a square.

Similarly, if $n < -1$, then $(n+1)^2 < (n+1)^2 - n < n^2$ yields a contradiction. So you've found all the solutions.

hunter
  • 29,847
2

Assuming that $n^2+n+1$ is a square, $4n^2+4n+4 = (2n+1)^2+3$ is a square, too, so there are two squares having difference $3$. The only squares with such a property are $1$ and $4$: draw your conclusions.

Jack D'Aurizio
  • 353,855
1

HINT:

$$(2n+1)^2+3=(2m)^2\iff3=(2n+1-2m)(2n+1-2m)$$

What are the factors of $3$?

1

We have: $n^2 + n + 1 = m^2 \implies n^2 + n + (1-m^2) = 0 \implies \triangle = 1^2 - 4(1)(1-m^2) = k^2 \implies 1-4(1-m^2) = k^2 \implies 4m^2 - k^2 = 3 \implies (2m+k)(2m-k) = 3\implies 2m+k = 3, 2m-k = 1$ or $2m+k = -1, 2m-k = -3$. Either case gives $n^2 + n = 0 \implies n = -1, 0$.

DeepSea
  • 77,651
0

As other solutions stated , one of your values can be obtained as like ,

$ n^2+n+1=k^2 \equiv 1 (mod 3) \implies n(n+1)\equiv 0 (mod 3)$

So $3|n$ or $3| (n+1)$ , put $n=3k$ , $f(k)=9k^2+3k+1=(3k+1)^2 - 3k$ which implies $n=k=0$ .

Secondly if $3|(n+1)$ put $n=3k-1$ & we get $ f(k)=9k^2-3k+1=(3k-1)^2+3k$ which forces $k=0$ & thus $n=3.0-1=-1$

We have $n^2<n^2+n+1<(n+1)^2$ and $n^2+n+1$ is perfect square for $n=0,-1$ .