Implementing homework 4.33 (perfect number)