[Math] How many integer solutions to a diophantine equation

diophantine equationselementary-number-theoryproject euler

Starting with the equation:

$\frac{1}{a}+\frac{1}{b}=\frac{p}{10^n}$,

I reached the equation:

$10^{n-log(p)} = \frac{ab}{a+b}$.

Now given the positive integer $n$, for what integer values of $p$ would the value of:

$10^{n-log(p)}$,

be rational?

Also, given positive integers $n$ and $p$, how would we find positive integer solutions to $a$ and $b$ that satisfy the second equation, where:

$a ≤ b$,

And is it possible to determine, given $n$ and $p$, how many $a$ and $b$ solutions exist?

Best Answer

As @Qiaochu Yuan noted, $10^{n-\log p}=\dfrac{10^n}{p}$ is always a rational number.



Suppose that a positive integer $n$ and an integr $p$ are given, and let $a$ and $b$ to be integers satisfying the above relation:

$$ \dfrac{1}{a}+\dfrac{1}{b}=\dfrac{p}{10^n} \Longleftrightarrow \\ pab = 10^na + 10^nb \Longleftrightarrow \\ p^2ab = 10^npa + 10^npb \Longleftrightarrow \\ p^2ab - 10^npa - 10^npb = 0 \Longleftrightarrow \\ p^2ab - 10^npa - 10^npb + 10^{2n} = 10^{2n} \Longleftrightarrow \\ (pa - 10^n) (pb - 10^n) = 10^{2n} . $$


notice that both of the factors $(pa - 10^n)$ and $(pb - 10^n)$ are (positive or negative) divisor of $10^{2n}$, so we can conclude that there is a (positive or negative) divisor $d$ of $10^{2n}$; such that:

$$ (pa - 10^n)=d \ \ \ \ \ \ \text{and} \ \ \ \ \ \ (pb - 10^n)=\dfrac{10^{2n}}{d} \ \ \ \ \ \ \Longleftrightarrow $$

$$ a = \dfrac {d+10^n} {p} \ \ \ \ \ \ \text{and} \ \ \ \ \ \ b = \dfrac { \dfrac{10^{2n}}{d} +10^n} {p} \ \ \ \ \ \ . $$

Related Question