http://en.wikipedia.org/wiki/Perfect_number Credit: @Leafino for fixing 2 parts of the problem. @WooHooBoy for some suggestions to fixing it which worked.