# $x^5 + x^4 +1$ to be a perfect square

Find all positive integers x such that $$x^5 + x^4 +1$$ is a perfect square.

My progress: factoring gives $$(x^3-x+1)(x^2+x+1)$$. The gcd of the factors is 1 or 7 and the first case is easily ruled out. But what if both multipliers are 7 times a square?

Any help appreciated.

• my observation is that the expression is an odd number so both factors are odd numbers. – Vasya Mar 12 at 20:32
• $x=2$ is a solution with $x^3-x+1=7=x^2+x+1$ so your second case can certainly not be ruled out entirely. – mxian Mar 12 at 21:33

Probably not a satisfying answer since it uses highly non-elementary methods, but it may be useful to list the solution for reference.

The equation $$E_1: y^2 = x^3-x+1$$ is an Elliptic curve. Similarly for $$7y^2=x^3-x+1$$ we can multiply by $$7^3$$ to get $$E_2: (7^2y)^2=(7x)^3-7^2(7x)+7^3 \Longleftrightarrow E_2: Y^2=X^3-49X+343$$ and it can be observed that $$E_2$$ is also an Elliptic curve.

By Siegel's Theorem, there are only finitely many integral points on Elliptic curves, so there can only be finitely many solutions to the equations. So the next goal is to get this finite list.

For a quick solution I got the results from LMFDB and cross checked with Sagemath.

For $$E_1$$, LMFDB says the integral points are $$(x,y) = (−1,\pm 1), (0, \pm 1), (1,\pm 1), (3,\pm 5), (5, \pm 11), (56, \pm 419)$$ Similarly for $$E_2$$, LMFDB says the integral points are $$(X,Y) = (14, \pm 49) \implies (x,y) = (2,\pm 1)$$ Hence a potential list of $$x$$ is $$\{-1,0,1,2,3,5,56\}$$ Now putting them into $$x^5+x^4+1 = w^2$$ we see that only $$x=-1,0,2$$ works.

This is only a partial answer, but I hope it provides the start to a possible way to solve the problem. As already noted in the question, the $$2$$ polynomial factors must each be $$7$$ times a square. In particular,

$$x^3 - x + 1 = 7w^2 \tag{1}\label{eq1}$$ $$x^2 + x + 1 = 7y^2 \tag{2}\label{eq2}$$

for some positive integers $$w$$ and $$y$$. The case where $$w = y$$ has been discussed in the answer by Martin Hansen. Note \eqref{eq2} can be made into the generic form $$a⁢x^2 + b⁢x⁢y + c⁢y^2 + d⁢x + e⁢y + f = 0$$ by moving the $$7y^2$$ to the left. Plugging the appropriate coefficients into Generic two integer variable equation solver gives the base positive solution of $$x = 2$$ and $$y = 1$$, with the recursion formulas of

$$x_{n+1} = 127 ⁢x_n + 336 ⁢y_n + 63 \tag{3}\label{eq3}$$ $$y_{n+1} = 48 ⁢x_n + 127 ⁢y_n + 24 \tag{4}\label{eq4}$$

and also:

$$x_{n+1} = 127 ⁢x_n - 336 ⁢y_n + 63 \tag{5}\label{eq5}$$ $$y_{n+1} = -48 ⁢x_n + 127 ⁢y_n - 24 \tag{6}\label{eq6}$$

If you're unsure or concerned that these are all possible solutions, then another approach is to note that \eqref{eq2} can also be treated as a quadratic equation in $$x$$, so the determinant must be a perfect square. In particular, this means that

$$1 - 4\left(1 - 7y^2\right) = a^2 \; \Rightarrow \; a^2 - 28y^2 = -3 \tag{7}\label{eq7}$$

for some positive integer $$a$$. According to AoPS Online's Pell equation, this is a Pell-like equation because it's of the form $$x^2 - Dy^2 = k$$. Regarding solving it, including determining what are all possible solutions, this is asked & with several good answers given in MSE's Does the Pell-like equation $$X^2-dY^2=k$$ have a simple recursion like $$X^2-dY^2=1$$?. Also, using Generic two integer variable equation solver again now gives the base positive solution of $$x = 5$$ and $$y = 1$$, with the recursion formulas of

$$x_{n+1} = 127 ⁢x_n + 672 ⁢y_n \tag{8}\label{eq8}$$ $$y_{n+1} = 24 ⁢x_n + 127 ⁢y_n \tag{9}\label{eq9}$$

and also:

$$x_{n+1} = 127 ⁢x_n - 672 ⁢y_n \tag{10}\label{eq10}$$ $$y_{n+1} = -24 ⁢x_n + 127 ⁢y_n \tag{11}\label{eq11}$$

Using either method, you now have a relatively small set of possible solutions to check by using the resulting values of $$x$$ in \eqref{eq1} to determine if the resulting $$w$$ is an integer. Unfortunately, I don't know if there's any analytic way to check for there being any solutions, much less the least one greater than $$w = 1$$ if any do exist.

Note you could also consider \eqref{eq1} to be a cubic equation in $$x$$ and then determine what conditions are required for an integral root, and what restrictions this imposes on $$w$$. However, I haven't tried this yet, so I don't know offhand if it'll help or not.

• I think the first equation $x^3 - x + 1 = 7w^2$ is the real problem, as already that one seems to have no solution by itself, except for $x=2,w=\pm 1$. – Sil Mar 13 at 8:52
• @Sil You may be correct, but I don't know how to prove it. Certainly, if there are any solutions, there will not be very many of them, relatively speaking. At least with the solutions for the second equation, it significantly limits the possible values to check for the first one. – John Omielan Mar 13 at 9:01

This is a part answer which I'll edit once I've thought some more;

As you observe $$x^5 + x^4 +1=(x^3-x+1)(x^2+x+1)$$

So $$x^5 + x^4 +1$$ will be a perfect square when, $$(x^3-x+1)=(x^2+x+1)$$ $$x^3-x^2-2x=0$$ $$x(x^2-x-2)=0$$ $$x(x-2)(x+1)=0$$ $$Either:x={-1,0,2}$$

So that's three values that make it true, two of which are removed as question asks for positive integers.

But are there more ?

I don't think there are, which is disappointing as it would be more fun if there were...

• Note that for $x>0$, $x^2<(x^2+x+1)<(x+1)^2$, so $x^2+x+1$ lies between two consecutive squares and therefore cannot itself be a perfect square. – Keith Backman Mar 12 at 21:04