# For how many integers $n$ is $n^6+n^4+1$ a perfect square? [duplicate]

QUESTION

For how many integers $$n$$ is $$n^6+n^4+1$$ a perfect square?

I am completely blank on how to start. Could anyone please provide tricks on how to get a start on such questions?

• It is for $n=0$ and $2$ Mar 12, 2020 at 4:43
• Yeah! It also includes -2..but the answer is correct! Mar 12, 2020 at 4:44
• Note: $\sqrt{n^6+n^4+\frac14n^2}=n(n+\frac12)$ Mar 12, 2020 at 4:49
• It should be pretty easy to show that $n$ can't be odd (check what digit the number ends with if $n$ is odd) Mar 12, 2020 at 4:51
• Really I meant $n(n^\color{red}2+\frac12)$ Mar 12, 2020 at 5:02

## Greetings

Dear @binarybitarray, if you see this post helpful, vote it up. I think I could point out that your equation has only 3 solutions being $$0,2,-2$$

Because the degrees of all factors in this sum are even, I may solve this question for natural numbers

First, it is easy to point out that if $$n$$ is odd, then $$n^6 + n^4 + 1 \equiv 3 \pmod {8}$$. However, a perfect square can only have a remainder of 0,1,4 upon its division for 8, therefore it is a contradiction.

Thus $$n$$ is even, set $$n=2m$$ and $$n^6 + n^4+ 1 = (2k+1)^2$$

$$\Rightarrow 64m^6 + 16m^4+1 = 4k^2+4k+1$$

$$\Rightarrow 16m^6+4m^4=k^2+k$$

$$\Rightarrow 16m^6+4m^4= k(k+1)$$

At this point, we may see that either $$k$$ is divisible by 4 or $$k+1$$ is.

Case I: $$k$$ is divisible by 4 Set $$k=4q$$, then we have

$$16m^6+4m^4=4q(4q+1)$$

$$\Rightarrow 4m^6+m^4= 4q^2 +q$$

$$\Rightarrow m^4(4m^2+1)=q(4q+1)$$

If m and q shares a prime divisor, it is easy to imply from $$4m^6+m^4= 4q^2 +q$$ that $$v_p(q)=4v_p(m)$$

If m and (4q+1) shares a prime divisor, it is easy to imply from $$m^4(4m^2+1)=q(4q+1)$$ that $$v_p(4q+1)=4v_p(m)$$

Thus, $$(4m^2+1) \ge m^3 \Rightarrow m \le 2$$.

• Apply $$m=2$$ we have $$n=4$$, which is not a solution.
• Apply $$m=1$$ we have $$n=2$$, which is a solution.
• Apply $$m=0$$ we have $$n=0$$, which is a solution

Case II: 4k+1 is divisible by 4,

Then $$m^4 (4m^2+1)=q(4q-1)$$

Using the same solving strategy as above we are guaranteed to also have $$n=0$$ or $$n=2$$

In a personal perspective, I think this is a pretty complicated question because of two things:

1. The degree of $$n$$ is $$6$$ and $$4$$, because 6 is not $$4\times 2$$ we cannot factorize the sum.
2. Also about the degree, if it is in the form $$x^{3k+1}+x^{3q+2}+1$$ then we can still factorize it. But that does not happen here.

Therefore, as far as I have been practicing on those problem, I think the most common strategy is to reduce the equation to as simple as possible, and then use inequalities to limit the number of possible values of the variable.

You can try applying it next time to see if it works.

Regards

• What do you mean by $v_p$? May 22, 2020 at 12:05
• It's the p-adic valuation. if p|a, then $v_p(a)$ is the power of p in the prime factorization of a. Jun 9, 2020 at 15:56

$$n^6 + n^4 + 1 = n^6 + n*n^3 + 1=n^6 + 2\frac n2*n^3 + \frac {n^2}4 +(1-\frac {n^2}4) =(n^3 + \frac n2)^2 + (1-\frac {n^2}4)$$

So if $$n\ge 2$$ then $$n^6 + n^4 + 1 \le (n^3 + \frac n2)^2$$ with equality holding only if $$n = 2$$.

And $$(n^3 +\frac {n}2 - 1)^2 =(n^3 +\frac {n-2}2)^2 = n^6 + (n-2)n^3 + \frac {n^2-4n -4}4=n^6 + n^4 - 2n^3 + \frac {n^2}4 -n -1.

So if $$n \ge 2$$ then $$(n^3 +\frac {n-2}2)^2 < n^6 + n^4 + 1 \le (n^3+\frac {n}2)^2$$ (with equality holding only if $$n =2$$).

So if $$n^6 + n^4 + 1$$ is a perfect square then either $$n=2$$ and $$n^6+n^4 + 1 = (n^3 +1)^2 = 9^2 = 81$$....

or...

$$n$$ is odd and $$n^6 + n^4 + 1 = (n^3 + \frac {n-1}2)^2$$... which would mean $$n^6 + n^4 + 1 = n^6 + (n-1)n^3 + (\frac{n-1}2)^2$$ or in other words:

$$n^3 -(\frac {n-1}2)^2 + 1=0$$

$$4n^3 - n^2 + 2n +3 = 0$$

By rational root theorem the only integer larger than $$2$$ that could work would be $$3$$ and ... it doesn't.

Now $$n^6 + n^6 + 1= (-n)^6 + (-n)^6 + 1$$ so if $$n$$ is a solution if and only if $$-n$$ is a solution and $$n = \pm 2$$ is the only solution where $$|n| \ge 2$$.

So just need to check if $$n = \pm 1, 0$$.

$$n=0$$ yields $$n^6 + n^4 + 1 = 0 = 1^2$$ but $$n=\pm 1$$ yields $$n^6 + n^4 + 1 = 3$$ which is not a perfect square.

So $$n=\pm 2$$ and $$n =0$$ are the only three integers that yield perfect squares.

Let $$m$$ and $$n$$ be integers such that $$m^2=n^6+n^4+1$$. Without loss of generality, we may assume that $$m$$ and $$n$$ are nonnegative. Clearly, $$(m,n)=(1,0)$$ is the only solution when $$n\in\{0,1\}$$.

If $$n\ge 2$$, then $$n^2\geq 4$$, so that $$(2n^3+n)^2=4n^6+4n^4+n^2\geq 4n^6+4n^4+4=4m^2\,.$$ On the other hand, \begin{align}4n^3-n^2+2n+3&\geq 8n^2-n^2+2n+3=7n^2+2n+3\\&\geq 7\left(n+\frac{1}{7}\right)^2+\frac{20}{7}\geq \frac{20}7>0\,,\end{align} whence \begin{align}(2n^3+n-1)^2&=4n^6+4n^4-4n^3+n^2-2n+1\\&<4n^6+4n^4+4=4m^2\,.\end{align} Therefore, $$(2n^3+n-1)^2<(2m)^2\leq (2n^3+n)^2\,.$$ Ergo, $$4n^6+4n^4+4=(2m)^2=(2n^3+n)^2$$, which means $$(m,n)=(9,2)$$.

With signs involved, there are in total $$3$$ possible values of integers $$n$$: $$-2$$, $$0$$, and $$+2$$. The equation $$m^2=n^6+n^4+1$$ has $$6$$ solutions $$(m,n)\in\mathbb{Z}\times\mathbb{Z}$$: $$(\pm 1,0)$$ and $$(\pm 9,\pm 2)$$.

The trivial solution $$n=0$$ is seen by inspection.

For $$n \ne 0$$, $$y^2=n^6+n^4+1 \Rightarrow (y+1)(y-1)=n^6+n^4$$.

Now $$(y+1)-(y-1)=2 \wedge \gcd{(y+1),(y-1)}=1,2$$ so we must resolve $$n^6+n^4$$ into two factors that differ by $$2$$ and have at most one factor of $$2$$ in common.

The factors $$n^4,(n^2+1)$$ are relatively prime, but $$n^4-(n^2+1)=2$$ has no solutions in the integers.

The factors $$n^2,n^2(n^2+1)$$ have $$n^2$$ as their $$\gcd$$, which is permissible only if $$n=1$$, but $$n=1$$ does not solve the original equation.

The factors $$n^3,n(n^2+1)$$ have $$n$$ as their $$\gcd$$, which is permissible if $$n=1$$ which we have already ruled out, or $$n=2$$, which solves the original equation. Noting that the original equation has $$n$$ in even powers, the solution $$-2$$ is also admitted because $$(-2)^{2k}=2^{2k}$$.

For completeness, we can look at $$n=cd$$ to see whether factoring $$n^6+n^4$$ might be done in any other way. However, $$d=1$$ changes nothing, and $$d>2$$ is not permitted, so we are constrained to examine $$n=2c$$. Also, that factor of $$2$$ can occur at most once in one of the factors of $$n^6+n^4$$, so we look at the factorizations $$8c^4,2(4c^2+1)$$ and $$2c^4, 8(4c^2+1)$$

After dividing through by $$4$$, $$8c^4-2(4c^2+1)=2 \Rightarrow 2c^4-2c^2=1$$ which is impossible because the difference of two even numbers is never $$1$$.

After dividing through by $$2$$, $$2c^4- 8(4c^2+1)=2 \Rightarrow c^4-16c^2-5=0$$. If we treat this as a quadratic equation in $$c^2$$, we derive $$c^2=8\pm \sqrt{69}$$ which is not an integer. So alternative factorings of $$n$$ do not change the outcome.

Solutions are $$\{0,\pm2\}$$

• This was a great solution.. but I didn't get the point where you showed the 'completeness' of the proof.. I mean, when you write $n=2c$, why do you say that the factor $2$ can occur atmost once$?$.. and will that not be $8c^4,2c(4c^2+1)$ $?$ May 22, 2020 at 11:56
• However you factor $n^6+n^4$, that factorization must be representable as $(y+1)(y-1)$. The factors of that product differ by $2$ and if they are even, represent two consecutive even numbers. For any two consecutive even numbers, one of them contains only a single factor of $2$. May 22, 2020 at 17:54