Checks for perfect numbers within a given range