public boolean checkPerfectNumber(int num) {
int sum = 1;
for (int i=2;i<Math.sqrt(num);i++)
if (num % i == 0) sum += i + (num/i == i ? 0 : num/i);
return num != 1 && sum == num;
}
Java 4Liner O(sqrt(n)) Solution

@compton_scatter Awesome, I tried the sqrt() boundary later but did not finish it. What a pitty.

