[Exercise Sync] Docs and Metadata for Affine-Cipher & Alphametics. (#3721)
* Synced docs for Affine-Cipher and Alphametics. * Alphametics metadata file.
This commit is contained in:
@@ -18,10 +18,10 @@ E(x) = (ai + b) mod m
|
|||||||
|
|
||||||
Where:
|
Where:
|
||||||
|
|
||||||
- `i` is the letter's index from `0` to the length of the alphabet - 1
|
- `i` is the letter's index from `0` to the length of the alphabet - 1.
|
||||||
- `m` is the length of the alphabet.
|
- `m` is the length of the alphabet.
|
||||||
For the Roman alphabet `m` is `26`.
|
For the Roman alphabet `m` is `26`.
|
||||||
- `a` and `b` are integers which make the encryption key
|
- `a` and `b` are integers which make up the encryption key.
|
||||||
|
|
||||||
Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
|
Values `a` and `m` must be _coprime_ (or, _relatively prime_) for automatic decryption to succeed, i.e., they have number `1` as their only common factor (more information can be found in the [Wikipedia article about coprime integers][coprime-integers]).
|
||||||
In case `a` is not coprime to `m`, your program should indicate that this is an error.
|
In case `a` is not coprime to `m`, your program should indicate that this is an error.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Instructions
|
# Instructions
|
||||||
|
|
||||||
Write a function to solve alphametics puzzles.
|
Given an alphametics puzzle, find the correct solution.
|
||||||
|
|
||||||
[Alphametics][alphametics] is a puzzle where letters in words are replaced with numbers.
|
[Alphametics][alphametics] is a puzzle where letters in words are replaced with numbers.
|
||||||
|
|
||||||
@@ -26,6 +26,4 @@ This is correct because every letter is replaced by a different number and the w
|
|||||||
|
|
||||||
Each letter must represent a different digit, and the leading digit of a multi-digit number must not be zero.
|
Each letter must represent a different digit, and the leading digit of a multi-digit number must not be zero.
|
||||||
|
|
||||||
Write a function to solve alphametics puzzles.
|
|
||||||
|
|
||||||
[alphametics]: https://en.wikipedia.org/wiki/Alphametics
|
[alphametics]: https://en.wikipedia.org/wiki/Alphametics
|
||||||
|
|||||||
@@ -27,5 +27,5 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"test_runner": false,
|
"test_runner": false,
|
||||||
"blurb": "Write a function to solve alphametics puzzles."
|
"blurb": "Given an alphametics puzzle, find the correct solution."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user