We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6200454 commit 9b7e39cCopy full SHA for 9b7e39c
Sum of Proper Divisors/SumOfProperDivisors.java
@@ -9,14 +9,17 @@ public static void main(String[] args) {
9
}
10
11
private static int seq(int n) {
12
+ if (n == 1) {
13
+ return 0;
14
+ }
15
int res = 0;
16
int i = 2;
- while(i <= Math.sqrt(n)){
- if(n % i == 0){
- res = (i == (n/i)) ? res+i : res + (i + (n/i));
17
+ while (i <= Math.sqrt(n)) {
18
+ if (n % i == 0) {
19
+ res = (i == (n / i)) ? res + i : res + (i + (n / i));
20
21
i += 1;
22
- return (res+1);
23
+ return (res + 1);
24
25
Sum of Proper Divisors/SumOfProperDivisors.py
@@ -1,6 +1,8 @@
1
import math
2
3
def divsum(n):
4
+ if n == 1:
5
+ return 0
6
res = 0
7
i = 2
8
while( i <= math.sqrt(n)):
0 commit comments