Skip to content

Commit e40d792

Browse files
all-your-base: convert to instructions and introduction (#2418)
* all-your-base: convert to instructions and introduction * Use math notation * Update description
1 parent 8513cb0 commit e40d792

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

exercises/all-your-base/description.md

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Instructions
2+
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+
5+
~~~~exercism/note
6+
Try to implement the conversion yourself.
7+
Do not use something else to perform the conversion for you.
8+
~~~~
9+
10+
## About [Positional Notation][positional-notation]
11+
12+
In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**.
13+
14+
The number 42, _in base 10_, means:
15+
16+
`(4 × 10¹) + (2 × 10⁰)`
17+
18+
The number 101010, _in base 2_, means:
19+
20+
`(1 × 2⁵) + (0 × 2⁴) + (1 × 2³) + (0 × 2²) + (1 × 2¹) + (0 × 2⁰)`
21+
22+
The number 1120, _in base 3_, means:
23+
24+
`(1 × 3³) + (1 × 3²) + (2 × 3¹) + (0 × 3⁰)`
25+
26+
_Yes. Those three numbers above are exactly the same. Congratulations!_
27+
28+
[positional-notation]: https://en.wikipedia.org/wiki/Positional_notation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Introduction
2+
3+
You've just been hired as professor of mathematics.
4+
Your first week went well, but something is off in your second week.
5+
The problem is that every answer given by your students is wrong!
6+
Luckily, your math skills have allowed you to identify the problem: the student answers _are_ correct, but they're all in base 2 (binary)!
7+
Amazingly, it turns out that each week, the students use a different base.
8+
To help you quickly verify the student answers, you'll be building a tool to translate between bases.

0 commit comments

Comments
 (0)