Skip to content

Commit 5c93f2c

Browse files
committed
perfect-numbers: 'natural number' -> 'positive integer'
There is no convention whether zero is a natural number, so let's avoid the issue. For example, see: - https://mathworld.wolfram.com/NaturalNumber.html - https://en.wikipedia.org/wiki/Natural_number - https://math.stackexchange.com/questions/283/is-0-a-natural-number The previous wording of ``` "description": "Zero is rejected (not a natural number)", ``` could be especially jarring for some tracks. For example, Nim defines `Natural` and `Positive` types, and `Natural` includes 0. See: - https://nim-lang.github.io/Nim/system.html#Natural
1 parent ea11935 commit 5c93f2c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

exercises/perfect-numbers/canonical-data.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,24 @@
120120
"cases": [
121121
{
122122
"uuid": "72445cee-660c-4d75-8506-6c40089dc302",
123-
"description": "Zero is rejected (not a natural number)",
123+
"description": "Zero is rejected (as it is not a positive integer)",
124124
"property": "classify",
125125
"input": {
126126
"number": 0
127127
},
128128
"expected": {
129-
"error": "Classification is only possible for natural numbers."
129+
"error": "Classification is only possible for positive integers."
130130
}
131131
},
132132
{
133133
"uuid": "2d72ce2c-6802-49ac-8ece-c790ba3dae13",
134-
"description": "Negative integer is rejected (not a natural number)",
134+
"description": "Negative integer is rejected (as it is not a positive integer)",
135135
"property": "classify",
136136
"input": {
137137
"number": -1
138138
},
139139
"expected": {
140-
"error": "Classification is only possible for natural numbers."
140+
"error": "Classification is only possible for positive integers."
141141
}
142142
}
143143
]

exercises/perfect-numbers/description.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Determine if a number is perfect, abundant, or deficient based on
2-
Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
2+
Nicomachus' (60 - 120 CE) classification scheme for positive integers.
33

4-
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
4+
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
55

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

0 commit comments

Comments
 (0)