Abundant Array
Description:
Your task is to return an array of the first n
abundant numbers, sorted by their abundance. If the abundance is the same for multiple numbers, sort them numbers from smallest to largest.
"An abundant number or excessive number is a number for which the sum of its proper divisors is greater than the number itself. The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a total of 16. The amount by which the sum exceeds the number is the abundance. The number 12 has an abundance of 4, for example."
For example:
10
is not an abundant because the sum of its proper divisors is 8;1+2+5=8
.12
is an abundant number with an abundance of 4;1+2+3+4+6=16, 16-12=4
.18
is an abundant number with an abundance of 3;1+2+3+6+9=21, 21-18=3
.
The first 5 abundant numbers sorted by their abundance are [20, 18, 12, 24, 30]
Number | Sum of Divisors | Abundance |
---|---|---|
20 | 22 | 2 |
18 | 21 | 3 |
12 | 16 | 4 |
24 | 36 | 12 |
30 | 42 | 12 |
You will be given n
, a number between 0 and 300 and must return an array of that length, and must do so within the test's time limit.
Similar Kata:
Stats:
Created | Oct 27, 2016 |
Published | Oct 27, 2016 |
Warriors Trained | 366 |
Total Skips | 10 |
Total Code Submissions | 936 |
Total Times Completed | 167 |
JavaScript Completions | 63 |
Python Completions | 114 |
Total Stars | 15 |
% of votes with a positive feedback rating | 97% of 72 |
Total "Very Satisfied" Votes | 67 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |