optimization

This commit is contained in:
shellhub 2020-08-21 00:00:48 +08:00
parent 8c5ec652f6
commit 34869cb5cb

View File

@ -25,7 +25,7 @@ public class AliquotSum {
*/
public static int aliquotSum(int number) {
int sum = 0;
for (int i = 1; i < number; ++i) {
for (int i = 1, limit = number / 2; i <= limit; ++i) {
if (number % i == 0) {
sum += i;
}