on isPercect (n) sum = 1 cnt = n/2 repeat with i = 2 to cnt if n mod i = 0 then sum = sum + i end repeat return sum=n end