|
2 | 2 |
|
3 | 3 | Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
|
4 | 4 |
|
5 |
| -The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum]. |
6 |
| -The aliquot sum is defined as the sum of the factors of a number not including the number itself. |
| 5 | +The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of [perfect](#perfect), [abundant](#abundant), or [deficient](#deficient) based on their [aliquot sum][aliquot-sum]. |
| 6 | +The _aliquot sum_ is defined as the sum of the factors of a number not including the number itself. |
7 | 7 | For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`.
|
8 | 8 |
|
9 |
| -- **Perfect**: aliquot sum = number |
10 |
| - - 6 is a perfect number because (1 + 2 + 3) = 6 |
11 |
| - - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28 |
12 |
| -- **Abundant**: aliquot sum > number |
13 |
| - - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16 |
14 |
| - - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36 |
15 |
| -- **Deficient**: aliquot sum < number |
16 |
| - - 8 is a deficient number because (1 + 2 + 4) = 7 |
17 |
| - - Prime numbers are deficient |
18 |
| - |
19 |
| -Implement a way to determine whether a given number is **perfect**. |
20 |
| -Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**. |
| 9 | +## Perfect |
| 10 | + |
| 11 | +A number is perfect when it equals its aliquot sum. |
| 12 | +For example: |
| 13 | + |
| 14 | +- `6` is a perfect number because `1 + 2 + 3 = 6` |
| 15 | +- `28` is a perfect number because `1 + 2 + 4 + 7 + 14 = 28` |
| 16 | + |
| 17 | +## Abundant |
| 18 | + |
| 19 | +A number is abundant when it is less than its aliquot sum. |
| 20 | +For example: |
| 21 | + |
| 22 | +- `12` is an abundant number because `1 + 2 + 3 + 4 + 6 = 16` |
| 23 | +- `24` is an abundant number because `1 + 2 + 3 + 4 + 6 + 8 + 12 = 36` |
| 24 | + |
| 25 | +## Deficient |
| 26 | + |
| 27 | +A number is deficient when it is greater than its aliquot sum. |
| 28 | +For example: |
| 29 | + |
| 30 | +- `8` is a deficient number because `1 + 2 + 4 = 7` |
| 31 | +- Prime numbers are deficient |
| 32 | + |
| 33 | +## Task |
| 34 | + |
| 35 | +Implement a way to determine whether a given number is [perfect](#perfect). |
| 36 | +Depending on your language track, you may also need to implement a way to determine whether a given number is [abundant](#abundant) or [deficient](#deficient). |
21 | 37 |
|
22 | 38 | [nicomachus]: https://en.wikipedia.org/wiki/Nicomachus
|
23 | 39 | [aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum
|
0 commit comments