|
1 | 1 | # Instructions
|
2 | 2 |
|
3 |
| -Convert a number, represented as a sequence of digits in one base, to any other base. |
| 3 | +Convert a sequence of digits in one base, representing a number, into a sequence of digits in another base, representing the same number. |
4 | 4 |
|
5 |
| -Implement general base conversion. |
6 |
| -Given a number in base **a**, represented as a sequence of digits, convert it to base **b**. |
7 |
| - |
8 |
| -## Note |
9 |
| - |
10 |
| -- Try to implement the conversion yourself. |
11 |
| - Do not use something else to perform the conversion for you. |
| 5 | +~~~~exercism/note |
| 6 | +Try to implement the conversion yourself. |
| 7 | +Do not use something else to perform the conversion for you. |
| 8 | +~~~~ |
12 | 9 |
|
13 | 10 | ## About [Positional Notation][positional-notation]
|
14 | 11 |
|
15 | 12 | In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**.
|
16 | 13 |
|
17 | 14 | The number 42, _in base 10_, means:
|
18 | 15 |
|
19 |
| -`(4 * 10^1) + (2 * 10^0)` |
| 16 | +`(4 × 10¹) + (2 × 10⁰)` |
20 | 17 |
|
21 | 18 | The number 101010, _in base 2_, means:
|
22 | 19 |
|
23 |
| -`(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)` |
| 20 | +`(1 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (0 × 2²) + (1 × 2¹) + (0 × 2⁰)` |
24 | 21 |
|
25 | 22 | The number 1120, _in base 3_, means:
|
26 | 23 |
|
27 |
| -`(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)` |
28 |
| - |
29 |
| -I think you got the idea! |
| 24 | +`(1 × 3³) + (1 × 3²) + (2 × 3¹) + (0 × 3⁰)` |
30 | 25 |
|
31 | 26 | _Yes. Those three numbers above are exactly the same. Congratulations!_
|
32 | 27 |
|
|
0 commit comments