<s>[INST] How to calculate the number of positive integral solutions for the equations $\frac{1}{x} + \frac{1}{y} = \frac{1}{ab}$? Given $a$, $b$.Calculate the number of positive integral solutions for the eqations $\frac{1}{x} + \frac{1}{y} = \frac{1}{ab}$, where $a$, $b$ can be up to $1000000.$
 [/INST] $\frac{1}{x}+\frac{1}{y}=\frac{1}{ab}\implies ab(x+y)=xy\implies(x-ab)(y-ab)=a^2b^2$
Thus, if $a^2b^2=pq$, we can take $x=ab+p,y=ab+q$, and the number of solutions is thus equal to the number of factorisations of $a^2b^2$, also known as $d(a^2b^2)$.
One way of seeing that the only solutions with positive $x,y$ are the ones listed is by sketching $(x-ab)(y-ab)=a^2b^2$, and noting that none of the bottom-left branch of the hyperbola are in the first quadrant.
</s>