Jump to content

Perfect numbers: Difference between revisions

Line 230:
}
int max = cast(int) sqrt(cast(real) n) + 1;
int totsum = 1;
for (int i = 2; i < max; i++) {
if (n % i == 0) {
totsum += i;
int q = n / i;
if (q > i) {
totsum += q;
}
}
}
return totsum == n;
}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.