The Abundant Range
MediumAcc. 92.1%
+30 XP 12
Territorial Factors
An Abundant number has divisors that sum to more than itself. In this mission, you must count how many of these occur between two points.
The Assignment
Your function receives parameters start and end.
- Initialize
countto 0. - Loop through every number from
starttoend. - For each number, use a nested loop to calculate its sum of proper divisors.
- If it's abundant, increment your global
count. - After the scan, print the final
count.
01EXAMPLE 1
Input
start=1, end=20Output
3Explanation: Abundants found: 12, 18, 20.
Constraints
- Double-nested loops.
- Include endpoints in the range.
MathLoops
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
start1
end20
Expected Output
3
Click RUN to test your solution