I would like to use Mathematica to find all positive integer triples $(m,n,r)$ satisfying
(1) $\frac{mr}{m+n}$ is an integer;
(2) $r-n > \frac{mr}{m+n}-1$;
(3) $r\le \max{(m,n)}$;
(4) $1\le m < 1000$, $1\le n < 1000$, $1\le r < 1000$, all integers.
The code I use is:
FindInstance[m*r ==(m+n)*s && r-n > m*r/(m+n)-1 && r <= Max[m,n] && 0<m<1000 && 0<n<1000 && 0<r<1000, {m,n,r,s}, Integers]
But I got an error that I don't understand
Update: As pointed by azerbajdzan, I should use Max instead of FindMaximum (corrected above for convenience of future reference.) I will still happy to see anyone who could improve the code, making it run faster.
Max
instead ofFindMaximum
. $\endgroup$r-n>m*r/(m+r)-1
but your code saysr-n>m*r/(m+n)-1
. $\endgroup$