# How to calculate the number of positive integral solutions for the equations $\frac{1}{x} + \frac{1}{y} = \frac{1}{ab}$? [closed]

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.$

$\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.
• Question says positive integer solutions. What is your condition on $p,q$? Commented Sep 25, 2016 at 13:29
• @iamvegan Since the condition is $x,y>0$, we need $ab+p>0$, $ab+q>0$. or $p,q>-ab$. Counting solutions where $p,q>0$ is easy, assuming you have the factorization of $ab$. When $p,q$ are negative, since at most one of $p$ and $q$ will have absolute value less than $ab$, the only way to have both absolute values less than or equal to $ab$ is to have them both equal to it, namely $p=q=-ab$. However, then $x=y=0$, which is not a valid solution, so there are no valid solutions with $p,q<0$. Commented Sep 25, 2016 at 13:44
• @iamvegan $pq=(ab)^2>0$, so either they are both positive or both negative. Commented Sep 25, 2016 at 13:50