|
1 |
| -# Instructions |
| 1 | +# Introduction |
2 | 2 |
|
3 |
| -Write a function to convert from normal numbers to Roman Numerals. |
| 3 | +Your task is to convert a number from Arabic numerals to Roman numerals. |
4 | 4 |
|
5 |
| -The Romans were a clever bunch. They conquered most of Europe and ruled |
6 |
| -it for hundreds of years. They invented concrete and straight roads and |
7 |
| -even bikinis. One thing they never discovered though was the number |
8 |
| -zero. This made writing and dating extensive histories of their exploits |
9 |
| -slightly more challenging, but the system of numbers they came up with |
10 |
| -is still in use today. For example the BBC uses Roman numerals to date |
11 |
| -their programmes. |
| 5 | +For this exercise, we are only concerned about traditional Roman numerals, in which the largest number is MMMCMXCIX (or 3,999). |
12 | 6 |
|
13 |
| -The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice |
14 |
| -these letters have lots of straight lines and are hence easy to hack |
15 |
| -into stone tablets). |
| 7 | +~~~~exercism/note |
| 8 | +There are lots of different ways to convert between Arabic and Roman numerals. |
| 9 | +We recommend taking a naive approach first to familiarise yourself with the concept of Roman numerals and then search for more efficient methods. |
16 | 10 |
|
17 |
| -```text |
18 |
| - 1 => I |
19 |
| -10 => X |
20 |
| - 7 => VII |
21 |
| -``` |
22 |
| - |
23 |
| -There is no need to be able to convert numbers larger than about 3000. |
24 |
| -(The Romans themselves didn't tend to go any higher) |
25 |
| - |
26 |
| -Wikipedia says: Modern Roman numerals ... are written by expressing each |
27 |
| -digit separately starting with the left most digit and skipping any |
28 |
| -digit with a value of zero. |
29 |
| - |
30 |
| -To see this in practice, consider the example of 1990. |
31 |
| - |
32 |
| -In Roman numerals 1990 is MCMXC: |
33 |
| - |
34 |
| -1000=M |
35 |
| -900=CM |
36 |
| -90=XC |
37 |
| - |
38 |
| -2008 is written as MMVIII: |
39 |
| - |
40 |
| -2000=MM |
41 |
| -8=VIII |
42 |
| - |
43 |
| -See also: http://www.novaroma.org/via_romana/numbers.html |
| 11 | +Make sure to check out our Deep Dive video at the end to explore the different approaches you can take! |
| 12 | +~~~~ |
0 commit comments