Skip to content

Commit 8b472de

Browse files
Sync docs and metadata for practice exercises (exercism#2644)
1 parent 9268baf commit 8b472de

9 files changed

Lines changed: 60 additions & 51 deletions

File tree

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
11
# Instructions
22

3-
Given a year, report if it is a leap year.
4-
5-
The tricky thing here is that a leap year in the Gregorian calendar occurs:
6-
7-
```text
8-
on every year that is evenly divisible by 4
9-
except every year that is evenly divisible by 100
10-
unless the year is also evenly divisible by 400
11-
```
12-
13-
For example, 1997 is not a leap year, but 1996 is.
14-
1900 is not a leap year, but 2000 is.
15-
16-
## Notes
17-
18-
Though our exercise adopts some very simple rules, there is more to learn!
19-
20-
For a delightful, four minute explanation of the whole leap year phenomenon, go watch [this youtube video][video].
21-
22-
[video]: https://www.youtube.com/watch?v=xX96xng7sAE
3+
Your task is to determine whether a given year is a leap year.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Introduction
2+
3+
A leap year (in the Gregorian calendar) occurs:
4+
5+
- In every year that is evenly divisible by 4
6+
- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400.
7+
8+
Some examples:
9+
10+
- 1997 was not a leap year as it's not divisible by 4.
11+
- 1900 was not a leap year as it's not divisible by 400
12+
- 2000 was a leap year!
13+
14+
~~~~exercism/note
15+
For a delightful, four minute explanation of the whole phenomenon of leap years, check out [this youtube video](https://www.youtube.com/watch?v=xX96xng7sAE).
16+
~~~~

exercises/practice/leap/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build.gradle"
2424
]
2525
},
26-
"blurb": "Given a year, report if it is a leap year.",
26+
"blurb": "Determine whether a given year is a leap year.",
2727
"source": "CodeRanch Cattle Drive, Assignment 3",
2828
"source_url": "https://coderanch.com/t/718816/Leap"
2929
}

exercises/practice/perfect-numbers/.docs/instructions.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,38 @@
22

33
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
44

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.
77
For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`.
88

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).
2137

2238
[nicomachus]: https://en.wikipedia.org/wiki/Nicomachus
2339
[aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum

exercises/practice/pythagorean-triplet/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"build.gradle"
3737
]
3838
},
39-
"blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.",
39+
"blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the triplet.",
4040
"source": "Problem 9 at Project Euler",
4141
"source_url": "https://projecteuler.net/problem=9"
4242
}

exercises/practice/queen-attack/.docs/instructions.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ A chessboard can be represented by an 8 by 8 array.
88

99
So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3) and the black queen at `f2` (zero-indexed at column 5, row 6), then you know that the set-up is like so:
1010

11-
```text
12-
a b c d e f g h
13-
8 _ _ _ _ _ _ _ _ 8
14-
7 _ _ _ _ _ _ _ _ 7
15-
6 _ _ _ _ _ _ _ _ 6
16-
5 _ _ W _ _ _ _ _ 5
17-
4 _ _ _ _ _ _ _ _ 4
18-
3 _ _ _ _ _ _ _ _ 3
19-
2 _ _ _ _ _ B _ _ 2
20-
1 _ _ _ _ _ _ _ _ 1
21-
a b c d e f g h
22-
```
11+
![A chess board with two queens. Arrows emanating from the queen at c5 indicate possible directions of capture along file, rank and diagonal.](https://assets.exercism.org/images/exercises/queen-attack/queen-capture.svg)
2312

2413
You are also able to answer whether the queens can attack each other.
2514
In this case, that answer would be yes, they can, because both pieces share a diagonal.
15+
16+
## Credit
17+
18+
The chessboard image was made by [habere-et-dispertire][habere-et-dispertire] using LaTeX and the [chessboard package][chessboard-package] by Ulrike Fischer.
19+
20+
[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire
21+
[chessboard-package]: https://github.com/u-fischer/chessboard

exercises/practice/rest-api/.docs/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ Your task is to implement a simple [RESTful API][restful-wikipedia] that receive
4444
[restful-wikipedia]: https://en.wikipedia.org/wiki/Representational_state_transfer
4545
[iou]: https://en.wikipedia.org/wiki/IOU
4646
[github-rest]: https://developer.github.com/v3/
47-
[reddit-rest]: https://www.reddit.com/dev/api/
47+
[reddit-rest]: https://web.archive.org/web/20231202231149/https://www.reddit.com/dev/api/
4848
[restfulapi]: https://restfulapi.net/

exercises/practice/spiral-matrix/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
},
3434
"blurb": "Given the size, return a square matrix of numbers in spiral order.",
3535
"source": "Reddit r/dailyprogrammer challenge #320 [Easy] Spiral Ascension.",
36-
"source_url": "https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/"
36+
"source_url": "https://web.archive.org/web/20230607064729/https://old.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/"
3737
}

exercises/practice/transpose/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
},
3333
"blurb": "Take input text and output it transposed.",
3434
"source": "Reddit r/dailyprogrammer challenge #270 [Easy].",
35-
"source_url": "https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text"
35+
"source_url": "https://web.archive.org/web/20230630051421/https://old.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text/"
3636
}

0 commit comments

Comments
 (0)