1
$\begingroup$

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

$\endgroup$

1 Answer 1

3
$\begingroup$

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

$\endgroup$
6
  • $\begingroup$ Question says positive integer solutions. What is your condition on $p,q$? $\endgroup$
    – iamvegan
    Commented Sep 25, 2016 at 13:29
  • $\begingroup$ @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$. $\endgroup$
    – Aaron
    Commented Sep 25, 2016 at 13:44
  • $\begingroup$ @Aaron How about the case where one of them is negative and the other is positive? $\endgroup$
    – iamvegan
    Commented Sep 25, 2016 at 13:49
  • $\begingroup$ @iamvegan $pq=(ab)^2>0$, so either they are both positive or both negative. $\endgroup$
    – Aaron
    Commented Sep 25, 2016 at 13:50
  • $\begingroup$ @Aaron you are right :) sorry $\endgroup$
    – iamvegan
    Commented Sep 25, 2016 at 13:51

Not the answer you're looking for? Browse other questions tagged .