Math + CS: Cracking The Secret Code

Math + CS: Cracking The Secret Code


In this activity I would like to demonstrate how concepts of Computer Science can be used to support numeracy. As many of you are aware, I am a big fan of coding to support critical thinking and math, but Computer Science is bigger than just coding.

Big Ideas:

Exponents, Patterns, Base 10, Base 2, Order of Operations


Explain to students that a binary string of 8 bits is a byte.

EG: 10111011 – Each digit is a bit, 8 bits is a byte (4 bits is a nibble)

Computers understand machine language (1s and 0s) and must convert it into “human language.”

Wiki: Binary Number

In mathematics and digital electronics, a binary number is a numberexpressed in the binary numeral system or base-2 numeral system which represents numeric values using two different symbols: typically 0 (zero) and 1 (one). The base2 system is a positional notation with a radix of 2. Because of its straightforward implementation in digital electronic circuitry using logic gates, the binary system is used internally by almost all modern computers and computer-based devices. Each digit is referred to as a bit.



Wiki: Converting Binary to Decimal:



Write down the binary number and list the powers of 2 from right to left. Let’s say we want to convert the binary number 100110112 to decimal. First, write it down. Then, write down the powers of two from right to left. Start at 20, evaluating it as “1”. Increment the exponent by one for each power. Stop when the amount of elements in the list is equal to the amount of digits in the binary number. The example number, 10011011, has eight digits, so the list, with eight elements, would look like this: 128, 64, 32, 16, 8, 4, 2, 1

** Continue reading:

The above Wiki is a great resource for teaching proper conversion from binary to decimal and such knowledge is required to complete this activity.

Show students an example of an ASCII table.

ASCII (American Standard Code for Information Interchange) is the most common format for text files in computers and on the Internet. In an ASCII file, each alphabetic, numeric, or special character is represented with a 7-bit binary number (a string of seven 0s or 1s). 128 possible characters are defined.


Here is an example. There is a lot of information listed, we will focus on the “Dec” column, which stands for decimal.


ascii table4.xlsx


Provide students with this “code” sheet (or one you have created) and have them “chunk” the bits into strings of 8 (one byte) in the boxes underneath.





Their job is to follow the Wiki instructions (or your lesson) and convert each 8 digit byte into a decimal value. Next they will look up the decimal value in the ASCII chart and find the corresponding alphabet letter. As you may have noticed, we are solving for a 6 letter word (Random) and yes, it is case sensitive.

With the fundamental understanding of how to convert binary to decimal, you can create some pretty unique learning opportunities. Perhaps you wish to hide binary code around the school or behind QR codes and create scavenger hunts. Maybe you want to support narrative writing by including binary “code” into stories for readers to “crack.”

Learning about exponents can be tricky. This method might offer some opportunities to scaffold and differentiate learning. You may wish to provide different students with different binary code. What I love most about activities like this is how the math is the skill needed to complete something more, something bigger, rather than just “doing math.”

For more lessons, activities and ideas, grab a copy of my book, Code Breaker, on Amazon here!

Digidal display with binary code, 3d generated image



(Visited 9,738 times, 1 visits today)

Leave a Reply

Email *