Number Theory – Olympiad Number Theory Problem GCD

contest-mathelementary-number-theorygcd-and-lcm

How many integers from $1, \dots, 500$ can be written in the form $\frac{x^2}{y} +\frac{y^2}{z} + \frac{z^2}{x}$, where $x,y,z \in \mathbb{N}$ with $\gcd(x,y,z) = 1$.

I started by saying that if $\gcd(x,y,z) = 1$, then if we let $\gcd(x,y) = a$, we see by Bezout's Lemma that there are integers $c,d$ such that $cx + dy = a$. Then, since $\gcd(x,y,z) = \gcd(a,z) = 1$, we see by Bezout's Lemma that there are integers $s,t$ such that $sa + tz = 1$. This, $scx + sdy + tz = 1$. But from here, I have no clue how to continue.

I've been told that the answer is 3, 65 and 386. If any of you could provide some guidance, it would be much appreciated.

Best Answer

Unfortunately, I don't see any way to continue with what you've done so far. Instead, start from the original problem of how many integers $1 \le n \le 500$ exist with

$$\frac{x^2}{y} + \frac{y^2}{z} + \frac{z^2}{x} = n \tag{1}\label{eq1A}$$

where $x,y,z \in \mathbb{N}$ with $\gcd(x,y,z) = 1$. Multiplying both sides by $zx$ and rearranging gives

$$\frac{x^3z}{y} = nxz - y^2x - z^3 \tag{2}\label{eq2A}$$

Since the RHS is an integer, the LHS must be as well. Thus, we have

$$y = y_{1}y_{2}, \;\; y_{1}\mid x^3, \;\; y_{2}\mid z, \;\; \gcd(y_1, y_2) = 1 \tag{3}\label{eq3A}$$

The last part comes from that, if there's any prime $p$ where $p \mid y_1$ and $p \mid y_2$, then $p\mid y$, $p \mid x^3 \;\to\; p\mid x$ and $p \mid z$. However, this gives $p \mid \gcd(x, y, z) = 1$, a contradiction.

We also similarly get

$$z = z_{1}z_{2}, \;\; z_{1}\mid y^3, \;\; z_{2}\mid x, \;\; \gcd(z_1, z_2) = 1 \tag{4}\label{eq4A}$$

$$x = x_{1}x_{2}, \;\; x_{1}\mid z^3, \;\; x_{2}\mid y, \;\; \gcd(x_1, x_2) = 1 \tag{5}\label{eq5A}$$

If there's any prime $p$ where $p\mid x_2$ and $p\mid z_2$, then from \eqref{eq5A}'s $x_2\mid y$ we get $p\mid y$, so $p \mid \gcd(x,y,z) = 1$. Since this is not allowed, it means $\gcd(x_2, z_2) = 1$. Thus, using $x = x_{1}x_{2}$ from \eqref{eq5A}, then from \eqref{eq4A}'s $z_2\mid x$, we get $z_2 \mid x_1$. Using similar logic for $y_1$ and $z_1$, we get for some integers $a$, $b$ and $c$ that

$$x_1 = az_2 \;\to\; x = az_{2}x_{2}, \;\; y_1 = bx_2 \;\to\; y = bx_{2}y_{2}, \;\; z_1 = cy_2 \;\to\; z = cy_{2}z_{2} \tag{6}\label{eq6A}$$

Next, if there's any prime $p$ where $p\mid x_1$ and $p\mid y_1$, then from \eqref{eq5A}'s $x_1\mid z^3$ we get the incorrect result of $p\mid\gcd(x,y,z)=1$. Thus, we also have

$$\gcd(x_1, y_1) = \gcd(x_1, z_1) = \gcd(y_1, z_1) = 1 \tag{7}\label{eq7A}$$

Multiplying both sides of \eqref{eq1A} by $xyz$, substituting \eqref{eq6A} and then dividing both sides by the common factor of $x_{2}y_{2}z_{2}$ results in

$$\begin{equation}\begin{aligned} x^{3}z + y^{3}x + z^{3}y & = nxyz \\ (az_{2}x_{2})^3(cy_{2}z_{2}) + (bx_{2}y_{2})^3(az_{2}x_{2}) + (cy_{2}z_{2})^3(bx_{2}y_{2}) & = n(az_{2}x_{2})(bx_{2}y_{2})(cy_{2}z_{2}) \\ a^{3}cz_{2}^{4}x_{2}^{3}y_{2} + b^{3}ax_{2}^{4}y_{2}^{3}z_{2} + c^{3}by_{2}^{4}z_{2}^{3}x_{2} & = nabcx_{2}^{2}y_{2}^{2}z_{2}^{2} \\ a^{3}cz_{2}^{3}x_{2}^{2} + b^{3}ax_{2}^{3}y_{2}^{2} + c^{3}by_{2}^{3}z_{2}^{2} & = nabcx_{2}y_{2}z_{2} \end{aligned}\end{equation}\tag{8}\label{eq8A}$$

Note $x_2$ is a factor of the first & second terms on the LHS, and also of the RHS, so it must be a factor of the third term on the LHS, i.e., $x_2 \mid c^{3}by_{2}^{3}z_{2}^{2}$. Using \eqref{eq6A} and \eqref{eq7A}, we have $\gcd(x_2,c^{3}y_{2}^{3}z_{2}^{2}) = 1$, so

$$x_2 \mid b \tag{9}\label{eq9A}$$

Similarly, considering the factors of $b$, we get

$$b \mid x_{2}^{2} \tag{10}\label{eq10A}$$

This means the set of prime factors that divide $b$ and $x_2$ must be the same. Consider any prime factor $p$ of $b$ and $x_{2}$. Using the $p$-adic valuation function, we get

$$\nu_{p}(x_2) = s_{1} \gt 0, \;\; \nu_{p}(b) = s_{2} \gt 0 \tag{11}\label{eq11A}$$

The number of factors of $p$ among the LHS terms of \eqref{eq8A} are $2s_1$, $3s_1 + 3s_2$ and $s_2$, respectively, while the RHS has $s_1 + s_2$. Note that the number of factors of $p$ among these must be such that no one term has a smallest number since then moving this term to one side by itself shows the other side has a larger number of factors of $p$, a contradiction. Since $3s_1 + 3s_2 \gt s_1 + s_2 \gt s_2$, this means we require

$$s_2 = 2s_1 \tag{12}\label{eq12A}$$

Since this is true for every prime factor $p$ of $x_2$ and $b$, we then get, while also doing the same thing for $z_2$ and $a$, plus $y_2$ and $c$, that

$$b = x_{2}^{2}, \;\; a = z_{2}^{2}, \;\; c = y_{2}^2 \tag{13}\label{eq13A}$$

Substituting these into \eqref{eq8A} and then dividing by the common factor of $x_{2}^{2}y_{2}^{2}z_{2}^{2}$ gives

$$\begin{equation}\begin{aligned} (z_{2}^{2})^{3}y_{2}^{2}z_{2}^{3}x_{2}^{2} + (x_{2}^{2})^{3}z_{2}^{2}x_{2}^{3}y_{2}^{2} + (y_{2}^2)^{3}x_{2}^{2}y_{2}^{3}z_{2}^{2} & = nz_{2}^{2}x_{2}^{2}y_{2}^2x_{2}y_{2}z_{2} \\ x_{2}^{2}y_{2}^{2}z_{2}^{9} + x_{2}^{9}y_{2}^{2}z_{2}^{2} + x_{2}^{2}y_{2}^{9}z_{2}^{2} & = nx_{2}^{3}y_{2}^{3}z_{2}^{3} \\ z_{2}^{7} + x_{2}^{7} + y_{2}^{7} & = nx_{2}y_{2}z_{2} \\ x_{2}^{7} + y_{2}^{7} & = z_{2}(nx_{2}y_{2} - z_{2}^{6}) \end{aligned}\end{equation}\tag{14}\label{eq14A}$$

Due to symmetry, WLOG let $x_2 \le y_2 \le z_2$. First, if $x_2 = y_2 = 1$, then \eqref{eq14A} becomes

$$2 = z_{2}(n - z_{2}^{6}) \tag{15}\label{eq15A}$$

This shows that $z_{2} \in \{1,2\}$. With $z_{2} = 1$, we get $2 = n - 1 \;\to\; n = 3$, while $z_{2} = 2$ gives $1 = n - 64 \;\to\; n = 65$.

Next, with $x_2 = 1$ and $y_2 = 2$, we get from \eqref{eq14A} that

$$1 + 128 = z_{2}(2n - z_{2}^{6}) \;\;\to\;\; 3\times 43 = z_{2}(2n - z_{2}^{6}) \tag{16}\label{eq16A}$$

Thus, $z_{2} \in \{3, 43, 129\}$, with $z_{2} = 3$ giving that $43 = 2n - 729 \;\to\; 2n = 772 \;\to\; n = 386$. Note $z_{2} = 43$ and $z_{2} = 129$ both give $n \gt 500$. I leave it to anybody interested to confirm there are no other values of $x_2$ and $y_2$ which have a coprime $z_2 \ge y_2$ giving $n \le 500$.

Thus, as you've already stated, we have $n \in \{3, 65, 386\}$, so there are only $3$ such integers $n$.