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