Proofs Involving an Algorithm Okay. I've been trying to work on a math proof and then I fell asleep. I feel as if it should be obvious but I'm not getting it at all.
The following is the info:
$$\frac{A}{B} = \frac{1}{n_{1}} + \frac{1}{n_{2}} + ... + \frac{1}{n_{k}}$$ where $n_{1}, n_{2}, ..., n_{k}$ are all different natural numbers, for some $k\geq 1$ and where $A$ and $B$ are natural numbers.
Here is an algorithm that tries to find such an expression for a given $\frac{A}{B}$ with $0<A<B$. 
 > - Let $x_{1}= \frac{A}{B}$. Let $\frac{1}{n_{1}}$ be the largest rational number of the form $\frac{1}{n}$ that is less than or qual to $x_{1}$ (i.e , satisfying $\frac{1}{n_{1}}\leq x_{1}<\frac{1}{n_{1}-1}$.) 
 > - Let $x_{2}$ = $x_{1} - \frac{1}{n_{1}}$. If $x_{2}\neq0$, let $\frac{1}{n_{2}}$ be the largest rational number of the form $\frac{1}{n}$ that is less than or equal to $x_{2}$.
 > - Repeat until $x_{i}=0$
Now the questions:
$1.)$ In the algorithm, show that $x_{2}=\frac{\alpha}{\beta}$ where $\alpha$ and $\beta$ are integers with $0\leq\alpha<A$.
(This one I seem to going in circles any help on this would be awesome)
$2.)$ Use the previous to prove that the algorithm must eventually stop, and that the statment... $$\frac{A}{B} = \frac{1}{n_{1}} + \frac{1}{n_{2}} + ... + \frac{1}{n_{k}}$$ where $n_{1}, n_{2}, ..., n_{k}$ are all different natural numbers, for some $k\geq 1$ and where $A$ and $B$ are natural numbers.
 is true for every positive rational number $\frac{A} {B}$ less than 1.
 (No idea on this one.)
I could use as much help as I can get. Thank you in advance.
 A: We have $$\frac\alpha\beta=\frac AB-\frac1{n_1}=\frac{An_1-B}{Bn_1} $$
where by choice of $n_1$, $An_1-B\ge 0$ and $A(n_1-1)-B<0$. Therefore $$0\leq An_1-B=A+A(n_1-1)+B)<A$$
and as $\frac\alpha\beta$ is obtained by possibly canceling common factors, even more so we have $0\leq\alpha<A$.
Of course also $\alpha<\beta$ so that the original consditions hold for $\alpha,\beta$ as for $A.B$ (except when $\alpha=0$ and we are done). As the strictly decreasing numerator cannot remain positive forever, we must reach a numerator of $0$ after finitely many steps and hence some $x_i=0$ (you may also formulate this as a proof by induction on the original numerator $A$).
But why are all $n_k$ different? In fact, we have $n_1<n_2<\ldots<n_i$. This follows because $\frac1{n_2}\leq\frac \alpha\beta=\frac AB-\frac1{n_1}$ implies first $\frac1{n_2}\leq \frac AB$, so by choice of $n_1$, $n_1\leq n_2$. But we cannot have $n_2=n_1$ either, as that would imply $\frac AB\geq \frac2{n_1}>\frac 1{n_1-1}$ (because certainly $n_1>1$)
