http://en.wikipedia.org/wiki/Amicable_numbers
I'm doing a research on amicable numbers and I wanted to write $p$, $q$ and $r$ numbers of Thābit ibn Qurra theorem. I tried to write $p$ and $r$ in terms of $q$. I calculated $p$ as $\frac{q-1}{2}$ and it was true for $2^n p q$, however, when it came to $r$, i found $\frac{q^2-q-3}{2}$ and it wasn't true for $2^n r$ when I put what I found instead of $r$. For instance, I found (220,217) instead of (220,284) as they are a pair of amicable numbers. Can you help me out?
P.S For easier calculations, I used $a$ instead of $2^n$ in all of my calculations.
The calculation of $r$ in terms of $q$ is not right. It should be $r=\frac{q^2+2q-1}{2}$.
Detail: We have $3\times 2^n=q+1$, so $9\times 2^{2n}=q^2+2q+1$, and therefore $$r=9\times 2^{2n-1}-1=\frac{q^2+2q+1}{2}-1=\frac{q^2+2q-1}{2}.$$
The case $n=2$ gives $q=11$, and therefore $r=71$. And $71\times 2^2=284$.