Skip to content

perfect-numbers: 'natural number' -> 'positive integer' #1691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions exercises/perfect-numbers/canonical-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,24 @@
"cases": [
{
"uuid": "72445cee-660c-4d75-8506-6c40089dc302",
"description": "Zero is rejected (not a natural number)",
"description": "Zero is rejected (as it is not a positive integer)",
"property": "classify",
"input": {
"number": 0
},
"expected": {
"error": "Classification is only possible for natural numbers."
"error": "Classification is only possible for positive integers."
}
},
{
"uuid": "2d72ce2c-6802-49ac-8ece-c790ba3dae13",
"description": "Negative integer is rejected (not a natural number)",
"description": "Negative integer is rejected (as it is not a positive integer)",
"property": "classify",
"input": {
"number": -1
},
"expected": {
"error": "Classification is only possible for natural numbers."
"error": "Classification is only possible for positive integers."
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions exercises/perfect-numbers/description.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Determine if a number is perfect, abundant, or deficient based on
Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
Nicomachus' (60 - 120 CE) classification scheme for positive integers.

The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for natural numbers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9

- **Perfect**: aliquot sum = number
- 6 is a perfect number because (1 + 2 + 3) = 6
Expand Down
2 changes: 1 addition & 1 deletion exercises/perfect-numbers/metadata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
blurb: "Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for natural numbers."
blurb: "Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers."
source: "Taken from Chapter 2 of Functional Thinking by Neal Ford."
source_url: "http://shop.oreilly.com/product/0636920029687.do"