Simplify `perfect_number` function.
Merge pull request #139 from utkarshkukreti/refactor-perfect-numbers

Simplify `perfect_number` function.