Number Systems

Intro to Number Systems

As children we grew up counting in the base ten system (1, 2, 3, etc). However, base ten is only one of many numerical systems. Over these past to weeks at Girls Talk Math at UNC, our task was to explore other number systems that are not as frequently used as the base 10 system, specifically binary and hexadecimal number systems.

Binary

The exact definition of binary is related to using a system of numerical notation that has 2 rather than 10 as a base. This means only two single digits are used, 0 and 1.

Binary is used for data storage. Binary basically makes it easier for computer processors to understand and interpret incoming information/instructions.

Binary was first discussed by Gottfried Leibniz in 1689 but binary numerical systems were not put to use until a binary converter was created hundreds of years later. The binary system was officially implemented just before the beginning of the nineteenth century.

To convert a decimal to binary, the powers of 2 have to be used. We know that 2 to the power of 0 is 1, 2 to the power of 1 is 4, 2 to the power of 3 is 8, 2 to the power of 4 is 16, 2 to the power of 5 is 32, 2 to the power of 6 is 64, 2 to the power of 7 is 128, 2 to the power of 8 is 256, and so on. To get a number in its binary form, we have to subtract it from the highest power of 2 it can go into, until there is a remainder of 0.

An example of converting from binary to decimal is shown below. When you add all of the decimal number values that are represented by a “1” in the number :

So our decimal form is 357 or three-hundred and fifty-seven as a decimal number.

Hexadecimals

This is where things start to get a little complicated. Now that we have looked over binary, we move on to hexadecimals.

The hexadecimals system is a system based on the number 16. The single digits include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, then to display 2 digit numbers, letters have to be used. So A = 10, B = 11, C = 12, D = 13, F = 14, G = 15.

For example 223 would be written as DF.

Lets explore how we got that!

Step 1: The largest power of 16 that goes into 223 is 16 to the 1st power which is 16 (remember that 16^2 = 256 > 223). 16 to the 1st power goes into 223 evenly 13 times (16 × 13 = 208 < 223, while 16 × 14 = 224 > 223). This means that the first digit is D (which is the value of 13 in the 16 base system).

Step 2: As mentioned, 13 multiplied by 16 is 208. We do this so we can subtract 16 to the first power from 223 to find the remainder: 208 subtracted form 223 is 15. 16 to the zeroth power is the highest power of 16 that goes into the remainder 15. 16 to the 0th power is 1. 1 goes into 115 evenly 15 times. This means the the last digit s is F (since F represents 15 in the base 16 system).

Step 3: So 223 in hexadecimal form is DF.

This section was the hardest in all the pen and paper math we solved because it was not intuitive. The binary to decimal came to us all easily, but once we jumped straight into the base 16 hexadecimals, the problems got a lot harder fast. Some of us understood after taking time to process the information and were able to share our newly obtained knowledge with our group members. This made the process of learning hexadecimals a lot easier!

Python

Python is a widely used general-purpose computer language that has many different elements. It was created by Guido van Rossum and it was released in 1991.

Part of our exploration of number systems was to create a converter that could receive an input in some number system, whether it’s a number or a letter, and output its proper value in a different number system.

We used variables, lists, loops, and functions to work on creating this converter. We also had to implement the information we learned on number systems to properly code this project.

Though Python was really interesting to learn, it was difficult at times. We had to guess and check our code often and many times we couldn’t figure out what to fix. Through help from our Team Leader and re-watching tutorial videos, we were able to learn a lot of new information and write a code for a working converter.