Amicable Number Algorithm

A related concept is that of a perfect number, which is a number that equals the sum of its own proper divisors, in other words a number which forms an aliquot sequence of period 1.Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. Fermat and Descartes also rediscovered pairs of amicable numbers known to Arab mathematicians. A general formula by which some of these numbers could be derived was invented circa 850 by the Iraqi mathematician Thābit ibn Qurra (826–901).Much of the work of Eastern mathematicians in this area has been forgotten.

Amicable Number source code, pseudocode and analysis