TITLE: Do there exist pairs of distinct real numbers whose arithmetic, geometric and harmonic means are all integers?
QUESTION [69 upvotes]: I self-realized an interesting property today that all numbers $(a,b)$ belonging to the infinite set $$\{(a,b): a=(2l+1)^2, b=(2k+1)^2;\ l,k \in N;\ l,k\geq1\}$$ have their AM and GM both integers.
Now I wonder if there exist distinct real numbers $(a,b)$ such that their arithmetic mean, geometric mean and harmonic mean (AM, GM, HM) all three are integers. Also, I wonder if a stronger result for $(a,b)$ both being integers exists.
I tried proving it, but I did not find it easy. For the AM, it is easy to assume a real $a$ and an AM $m_1$ such that the second real $b$ equals $2m_1-a$. For the GM, we get a condition that $m_2=\sqrt{(2m_1-a)a}$. If $m_2$ is an integer, then… what? I am not sure exactly how we can restrict the possible values of $a$ and $m_1$ in this manner.

REPLY [8 votes]: Integer Case
If we start out with
$$
a=\frac{x+y}2,\quad g=\sqrt{xy},\quad h=\frac{2xy}{x+y}\tag1
$$
we have that
$$
ah=g^2\tag2
$$
Furthermore, note that
$$
a^2-g^2=\left(\frac{x-y}2\right)^2=d^2\tag3
$$
that is,
$$
a^2=g^2+d^2\tag4
$$
So this is related to Pythagorean Triples.
Furthermore, if $a\mid g^2$, then $h=\frac{g^2}a$ is an integer.
Given any Pythagorean Triple, $k^2+m^2=n^2$ with $(n,m)=1$ (this answer shows how to generate all primitive Pythagorean Triples), we need to multiply by $n$ to ensure that $a\mid g^2$. That is, let
$$
a=n^2,\quad d=mn,\quad g=kn\tag5
$$
then
$$
h=k^2,\quad x=n(n+m),\quad y=n(n-m)\tag6
$$
and $(6)$ gives all $x,y\in\mathbb{Z}$ where $\frac{x+y}2,\sqrt{xy},\frac{2xy}{x+y}\in\mathbb{Z}$ and $\left(\frac{x+y}2,\frac{2xy}{x+y}\right)=1$.

Examples
The smallest Pythagorean Triple is $(3,4,5)$. This gives two pairs:
$(5(5+3),5(5-3))=(40,10)$ whose (AM, GM, HM) are $(25,20,16)$.
$(5(5+4),5(5-4))=(45,5)$ whose (AM, GM, HM) are $(25,15,9)$.

Real Case
If we let $x,y\in\mathbb{R}$, then the important restriction is $(2)$ above. That is, $ah=g^2$. That is, if we have
$$
a=\prod_k p_k^{e_k}\tag7
$$
Then if we have $g\lt a$ so that
$$
\left.\prod_k p_k^{\left\lceil e_k/2\right\rceil}\,\middle|\,g\right.\tag8
$$
where $\lceil x\rceil$ is the ceiling function, the least integer not less than $x$.
Then $a\mid g^2$ and $h=\frac{g^2}a$ is an integer. Note that to have $a\ne g$, we need some $e_k\ge2$. For such $a$ and $g$, we have
$$
x=a+\sqrt{a^2-g^2},\quad y=a-\sqrt{a^2-g^2}\tag9
$$

Examples
Extending the example above, let's consider $a=25$. In that case, we are looking for $g\lt25$ so that $5\mid g$. $g=20$ and $g=15$ are given above; however, there are two other cases:
$g=10$: which gives $x=25+5\sqrt{21}$ and $y=25-5\sqrt{21}$ and $h=4$.
$g=5$: which gives $x=25+10\sqrt6$ and $y=25-10\sqrt6$ and $h=1$.
We can even have non-square $a$. For example, $a=12$. In this case we are looking for $g\lt12$ so that $6\mid g$. That is,
$g=6$: which gives $x=12+6\sqrt3$ and $y=12-6\sqrt3$ and $h=3$.