TITLE: Integer values of $\frac{x}{y}+\frac{y}{z}+\frac{z}{x}$?
QUESTION [18 upvotes]: What are the possible integer values of
$$\frac{x}{y}+\frac{y}{z}+\frac{z}{x}$$
where $x$, $y$, and $z$ are positive integers?
My suspicion is the the only integer values are $3$ and $5$, the former achievable whenever $(x,y,z)=k(1,1,1)$, and the latter achievable when $(x,y,z)=k(1,2,4)$. This suspicion is only based on playing around with the numbers for a while. I tried multiplying out the factors and using divisibility arguments, but nothing came of it.
This question is motivated by this one, so I'm particular interested if the given sum is ever equal to $4$.
EDIT: My suspicion has turned out to be quite wrong. Please see several examples of other solutions in the comments and answers.

REPLY [6 votes]: One of methods:
$p=\dfrac{x}{y}$, $q=\dfrac{y}{z}$, $r=\dfrac{z}{x}=\dfrac{1}{pq}$.
(one of them must be $\le 1$).
$$
p+q+\dfrac{1}{pq}=n,
$$
$$
p^2q+pq^2+1-npq=0,
$$
(quadratic equation on $q$):
$$
p\cdot q^2 + (p^2-np)q+1=0
$$
$$
q_{1,2}=\dfrac{np-p^2\pm\sqrt{p^4-2np^3+n^2p^2-4p}}{2p}.
$$
To be $q_{1,2}$ rational, must be
$$
p^4-2np^3+n^2p^2-4p = s^2, \qquad s\in \mathbb{Q}.
$$
If $p=\dfrac{a}{b}$, then $(x,y,z)=(2ab, 2b^2, abn-a^2\pm s)$ (after killing all common factors).
Of course, cyclic shift of $x,y,z$ may be applied here.
This way, we can find a few integer values of $n$ for not so large vlues of $x,y,z$ (see table below):
\begin{array}{|c|ll|}
\hline
n & (x,y,z) & \\ \hline
3 & (1,1,1) & \\ \hline
5 & (1,2,4) & \\ \hline 
6 & (4, 3, 18) & = (1\cdot 2^2, 3\cdot 1^2, 2\cdot 3^2) \\
  & (9, 2, 12) & = (1\cdot 3^2, 2\cdot 1^2, 3\cdot 2^2)\\ \hline
9 & (12, 63, 98) & =(3\cdot 2^2, 7\cdot 3^2, 2\cdot 7^2) \\
  & (18, 28, 147) &= (2\cdot 3^2, 7\cdot 2^2, 3\cdot 7^2) \\ \hline
10 & (175, 882, 1620) & = (7\cdot 5^2, 18 \cdot 7^2, 5\cdot 18^2 ) \\
   & (245, 450, 2268) & = (5\cdot 7^2, 18 \cdot 5^2, 7\cdot 18^2) \\ \hline
13 & (1053, 6422, 12996) & =(13\cdot 9^2, 38\cdot 13^2, 9\cdot 38^2)\\
   & (1521, 3078, 18772) & = (9\cdot 13^2, 38\cdot 9^2, 13\cdot38^2) \\ \hline
14 & (98, 52, 1183) & = (2\cdot 7^2, 13\cdot 2^2, 7\cdot 13^2)\\
   & (338, 28, 637) & = (2\cdot 13^2, 7\cdot 2^2, 13\cdot 7^2)\\ \hline
17 & (1620, 925, 24642) & = (5\cdot 18^2, 37\cdot 5^2, 18\cdot 37^2) \\
   & (6845, 450, 11988) & = (5\cdot 37^2, 18\cdot 5^2, 37\cdot 18^2)  \\ \hline
18 & (22932, 16055, 379050) \\
   & (117325, 7098, 167580) \\ \hline
19 & (25, 9, 405) \\
   & (81, 5, 225) \\ \hline
21 & (338, 84, 5733) \\
   & (882, 52, 3549) \\ \hline
26 & (12996, 7371, 314678) \\
   & (74529, 3078, 131404) \\ \hline
29 & (31347, 336518, 894348) \\
   & (49923, 132678, 1424332) \\ \hline
30 & (882, 124, 20181) \\
   & (1922, 84, 13671) \\ \hline
38 & (739900, 14341829, 27694870) \\
   & (1596070, 3082100, 59741791) \\ \hline
41 & (2, 36, 81) \\
   & (4, 9, 162) \\ 
   & (196, 5, 350) \\
   & (25, 14, 980) \\ 
   & (3698, 124, 41323) \\
   & (1922, 172, 57319) \\ \hline
51 & (1053, 13013, 53361) \\
   & (1521, 6237, 77077) \\ \hline
53 & (28, 1323, 1458) \\
   & (98, 108, 5103) \\ \hline
54 & (3698, 228, 139707) \\
   & (6498, 172, 105393) \\ \hline
57 & (1825900, 32851, 2567110) \\
   & (157339, 111910, 8745100) \\
66 & (3, 126, 196) \\
   & (9, 14, 588) \\ \hline
69 & (6498, 292, 303753) \\
   & (10658, 228, 237177) \\
   & (167580, 4720075, 11488218) \\
   & (379050, 922572, 25985255) \\ \hline
83 & (225, 4941, 18605) \\
   & (405, 1525, 33489) \\ \hline
86 & (10658, 364, 604513) \\
   & (16562, 292, 484939) \\ \hline
94 & (12229083, 132678, 22292452) \\
   & (894348, 490617, 82433078) \\ \hline
105 & (24642, 364, 919191) \\
    & (16562, 444, 1121211) \\ \hline
106 & (1225, 54, 102060) \\
  & (35, 66150, 2916) \\ \hline
... & ...
\end{array}

It iv very interesting that all founded values have form
$$
(x,y,z)_1 = (a^2b, b^2c, c^2a);\\
(x,y,z)_2 = (b^2a, a^2c, c^2b).
$$