File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,9 @@ runnableExamples:
5
5
for number in [12 , 100 ]:
6
6
echo fmt" The sum of all the proper divisors of { number} is { aliquotSum(number)} "
7
7
8
- func aliquotSum(number: Natural ): Natural {.raises: [ValueError].} =
8
+ func aliquotSum(number: Positive ): Natural {.raises: [ValueError].} =
9
9
# # Returns the sum of all the proper divisors of the number
10
10
# # Example: aliquotSum(12) = 1 + 2 + 3 + 4 + 6 = 16
11
- if number == 0 :
12
- raise newException(ValueError, " Input number must be strictly positive" )
13
11
result = 0
14
12
for divisor in 1 .. (number div 2 ) :
15
13
if number mod divisor == 0 :
@@ -25,7 +23,3 @@ when isMainModule:
25
23
for i in 0 ..< input.len:
26
24
check:
27
25
aliquotSum(input[i]) == expected[i]
28
-
29
- test " `aliquotSum` raises ValueError on non-positive entries" :
30
- doAssertRaises(ValueError):
31
- discard aliquotSum(0 )
You can’t perform that action at this time.
0 commit comments