Skip to content

Commit 83e1e5d

Browse files
committed
refine wording
1 parent 098e4c8 commit 83e1e5d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

exercises/luhn/instructions.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,23 @@ All other non-digit characters are disallowed.
1414

1515
### Valid credit card number
1616

17-
```text
18-
4539 3195 0343 6467
19-
```
17+
The number to be checked is `4539 3195 0343 6467`.
2018

21-
The first step of the Luhn algorithm is to double every second digit, starting from the rightmost (last) digit of the number and moving left.
19+
The first step of the Luhn algorithm is to start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.
2220

2321
```text
2422
4539 3195 0343 6467
2523
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
2624
```
2725

28-
If the result of doubling a digit is greater than 9, subtract 9 from that result.
26+
If the result of doubling a digit is greater than 9, we subtract 9 from that result.
2927
We end up with:
3028

3129
```text
3230
8569 6195 0383 3437
3331
```
3432

35-
Then sum all digits, and if the sum is evenly divisible by 10, the original number is valid.
33+
Finally, we sum all digits, and if the sum is evenly divisible by 10, the original number is valid.
3634

3735
```text
3836
8 + 5 + 6 + 9 + 6 + 1 + 9 + 5 + 0 + 3 + 8 + 3 + 3 + 4 + 3 + 7 = 80
@@ -42,25 +40,23 @@ Then sum all digits, and if the sum is evenly divisible by 10, the original numb
4240

4341
### Invalid Canadian SIN
4442

45-
```text
46-
066 123 468
47-
```
43+
The number to be checked is `066 123 468`.
4844

49-
Double every second digit starting from the rightmost (last) digit of the number and moving left.
45+
We start at the end of the number and double every second digit, beginning with the second digit from the right and moving left.
5046

5147
```text
5248
066 123 478
5349
↑ ↑ ↑ ↑ (double these)
5450
```
5551

56-
If the result of doubling a digit is greater than 9, subtract 9 from that result.
52+
If the result of doubling a digit is greater than 9, we subtract 9 from that result.
5753
We end up with:
5854

5955
```text
6056
036 226 458
6157
```
6258

63-
Sum the digits:
59+
We sum the digits:
6460

6561
```text
6662
0 + 3 + 6 + 2 + 2 + 6 + 4 + 5 + 8 = 36

0 commit comments

Comments
 (0)