OFFSET
1,2
COMMENTS
This uses the Stern-Brocot sequence s = A002487 to enumerate all (nonnegative) rational x = s(n)/s(n+1) and similarly y = s(m)/s(m+1) (WLOG m <= n) which yield a rational solution {x, y, z} for the "Sum equals product problem", x*y*z = x+y+z = integer. The equality implies that z = (x+y)/(xy-1).
(z may be negative for negative integer solutions, which correspond to positive solutions if all the signs of (x, y, z) are flipped.
EXAMPLE
k | x | y | z | xyz = x+y+z
---+-----+-----+-----+------------
0 | 0 | 0 | 0 | 0
3 | 2 | 1 | 3 | 6
5 | 3/2 | 1/2 | -8 | -6
7 | 3 | 1 | 2 | 6
9 | 4/3 | 2/3 | -18 | -16
11 | 5/2 | 1/2 | 12 | 15
15 | 4 | 1/2 | 9/2 | 9
17 | 5/4 | 3/4 | -32 | -30
PROG
CROSSREFS
KEYWORD
nonn,more
AUTHOR
M. F. Hasler, Sep 16 2024
STATUS
approved