Integer solutions to $m+n=\text{gcd}(m,n)+\text{lcm}(m,n)=9!$ Recently, I have found this problem:

Given two natural numbers $m$ and $n$, find the number of tuples $(m,n)$ such that:
$$m+n=\text{gcd}(m,n)+\text{lcm}(m,n)=9!$$

I hav completely no idea of how to do it because I am used to operate with the formula $\text{gcd}(m,n)\cdot\text{lcm}(m,n)$ and not with the sum $\text{gcd}(m,n)+\text{lcm}(m,n)$.
In order to escape from this problem, I have tried to set $n=9!-m$ and then substitute for $n$, but here I am stuck agian because I have to work with:
$$\text{gcd}(m,9!-m)+\text{lcm}(m,9!-m)$$
Any idea of how to proceed? Thanks.
 A: I’ll get you started. Let $d=\operatorname{gcd}(m,n)$, and let $m'=\frac{m}d$ and $n'=\frac{n}d$. Then $\operatorname{gcd}(m',n')=1$ and $\operatorname{lcd}(m,n)=dm'n'$, so
$$m'+n'=1+m'n'=\frac{9!}d\;.$$
Now
$$\begin{align*}
0&=(1+m'n')-(m'+n')\\
&=m'n'-m'-n'+1\\
&=(m'-1)(n'-1)\;,
\end{align*}$$
so $m'=1$ or $n'=1$. Can you take it from here?
A: Let $\gcd(m,n) = d$.  Let $\frac md = m'$ and $\frac nd = n'$. We know $\gcd(m',n')=1$.
The we have $m+n = d(m'+n')$ and
$\gcd(m,n) + \operatorname{lcm}(m,n) = d + \frac {mn}d = d+m'n'd = d(1+m'n')$
And $9! =2^7*3^3*5*7$
So $m'+n' = 1+m'n'$.
If we consider the lesser one of $m',n'$ to be $a$ and the larger to be $b$ we have.  Then $1+ab = a+b \le 2b$ so $\frac 1{b} + a \le 2$ so $a< 2$ so $a = 1$ and $m=d$
so we have $m(1+n') = 2^7*3^3*5*7$.
So we can have any $m|9!$ and $n= m(\frac {9!}m -1)= 9!-m$.
Verify ...
If $m|9!$ and $n = 9!-m$ then $m+n = m + (9!-m) = 9!$.  Check.
We know $m|m$ and no higher number than $m$ divides $m$.  And if $m|9!$ then $m|9!-m$ so $m$ is a common divisor of $m$ and $n$ and $m$ is the greatest common divisor so $\gcd(m,n) + \operatorname{lcm}(m,n)= m + \frac {mn}m = m+ n = 9!$.  Check.
Yup those are the answers.
Now how many $(n,m)$ pairs are there.
Well if we consider that $m|9!$ and $n = 9!-m$ we have $9!=2^7*3^4*5*7$ so $9!$  has $(7+1)(4+1)(1+1)(1+1)=8*5*2*2 = 160$ possible factors.  But we can't have $m=9!$ and $n=9!-9!=0$.  So there are $159$ pairs $(m,n)$ where $m|9!$ and $n=9!-m \ge 1$.  But we also have $159$ pairs $(m,n)$ where $n|9!$ and $m=9!-n$.  And those two sets will have the pair $(m,n)$ in common if both $m|9!;m\ne 9!$ and $n=9!-m|9!$.
Bur $m|9!$ and $m\ne 9!$ means $1\le m\le \frac {9!}2$ so $n=9!-m\ge \frac {9!}2 < 9!$ but $n|9!$ so that means $n=m=\frac {9!}2$.
So there are $2*159-1= 317$ such pairs.
