function is_perfect(integer n) return sum(factors(n,-1))=n end function for i=2 to 100000 do if is_perfect(i) then ?i end if end for