Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

77%
+5 −0
Challenges Are they abundant, deficient or perfect?

Abundant numbers are numbers which are less than their proper divisor sum. For example $18$ is abundant as $1 + 2 + 3 + 6 + 9 = 21 > 18$ Deficient numbers are numbers which are greater than the...

8 answers  ·  posted 3y ago by caird coinheringaahing‭  ·  last activity 2y ago by General Sebast1an‭

#1: Initial revision by user avatar caird coinheringaahing‭ · 2021-06-16T14:34:47Z (almost 3 years ago)
Are they abundant, deficient or perfect?
[Abundant numbers](https://en.wikipedia.org/wiki/Abundant_number) are numbers which are less than their [proper divisor sum](https://en.wikipedia.org/wiki/Aliquot_sum). For example \$18\$ is abundant as \$1 + 2 + 3 + 6 + 9 = 21 > 18\$

[Deficient numbers](https://en.wikipedia.org/wiki/Deficient_number) are numbers which are greater than their proper divisor sum. For example, \$15\$ is deficient as \$1 + 3 + 5 = 9 < 15\$

[Perfect numbers](https://en.wikipedia.org/wiki/Perfect_number) are numbers wich are equal to their proper divisor sum. For example, \$6\$ is perfect as \$1 + 2 + 3 = 6\$.

You should take a positive integer \$x \ge 12\$ and output three lists. The lists should contain, in any order, the abundant numbers less than or equal to \$x\$, the deficient numbers less than or equal to \$x\$ and the perfect numbers less than or equal to \$x\$.

For example, if \$x = 15\$, the output could look like

    [[12], [6], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15]]

This is code golf, so the shortest code in bytes wins

## Test cases

```
49 -> [[12, 18, 20, 24, 30, 36, 40, 42, 48], [6, 28], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23, 25, 26, 27, 29, 31, 32, 33, 34, 35, 37, 38, 39, 41, 43, 44, 45, 46, 47, 49]]
32 -> [[12, 18, 20, 24, 30], [6, 28], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23, 25, 26, 27, 29, 31, 32]]
16 -> [[12], [6], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16]]
29 -> [[12, 18, 20, 24], [6, 28], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23, 25, 26, 27, 29]]
23 -> [[12, 18, 20], [6], [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 21, 22, 23]]