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.

  1. Initialize count to 0.
  2. Loop through every number from start to end.
  3. For each number, use a nested loop to calculate its sum of proper divisors.
  4. If it's abundant, increment your global count.
  5. After the scan, print the final count.

01EXAMPLE 1

Inputstart=1, end=20
Output3

Explanation: Abundants found: 12, 18, 20.

Constraints

  • Double-nested loops.
  • Include endpoints in the range.
MathLoops
JavaScript
Loading...
3 Hidden

Input Arguments

start1
end20

Expected Output

3

Click RUN to test your solution