The Ins & Outs of Color Counting

Grab 5 or 6 different-colored sets of around 10-20 things – preferably stackable, like blocks or poker chips, but anything you can arrange into piles will do. The general idea is that we want to build towers of increasing height (starting from 1, then 2, and so on) using the different colors as our building blocks, where each color represents a different, set number of blocks. Therefore, if two different towers use the same color, they must also use the same amount of that particular color.

Share on facebook
Facebook
Share on twitter
Twitter

If you need further clarification on the rules, you can watch the video below.

Question 1: Dealing with 3 colors

Starting from 1, then 2, and so on, what is the largest number of unique towers you can make using just three colors? 

First, let’s look at 2 colors. If we have to start with towers of size 1 and 2, then we know that the first two colors must be a stack of 1 and a stack of 2, since a stack of two 1s breaks the rules. Let’s say red = 1 and yellow = 2. The largest number of towers we can make with those two colors is then only 3 – red, yellow, and the combination of red and yellow.

In order to get the number 4, we must add a new color. Let’s say green = 4. Now, we can arrange the colors into stacks such that they reach all the way to a tower of 7, as shown below. Had I used any other colors, it would have been repetitive (2+1 = 3, so why would I need a color for 3?).

Notice a pattern here? Visually, you can already see that the pattern for the first two colors repeats itself. Why? Well, the first two colors took care of three different numbered towers: 1, 2, and 3. In order to continue consecutively from the tower of height 4, we need to add 1, then 2, then 3. Then, we’ve made towers of heights 1, 2, … , 7. In order to continue consecutively from the number 8, we need to add 1, 2, … , 7. Do you see where this is going?

Before moving any further, try using the strategy we developed above to find the largest amount of towers you can make with 4 or 5 colors – you might see a new pattern emerge!

Challenge #1

Can you find an expression for the largest amount of towers you can make for any number of colors?

Let’s keep going with the same method we used above. Once we get stuck at 7, we add a new color: purple = 8. That gives us all the towers up to 15 units tall. 

So, from the bottom again: for 1 color, we can make 1 tower. Pretty simple. For 2 colors, we can make 3 (of height 1, 2, and 3). For 3 colors, we can make up to 7. If you continue to calculate this for 4 and 5, you start to see a pattern emerge: 1, 3, 7, 15, 31… 

Notice anything familiar about that pattern? Well, if you add 1 to every number, you get the sequence 2, 4, 8, 16, 32… the series of 2^n, where n starts at 1. In order to get back to our first series, we must simply subtract 1 from each element in the series. Therefore, the expression for the largest amount of towers you can make from n colors gives us (2^n) – 1. 

To check our work, we know 3 colors should give us lucky number 7. (2^3) – 1 = 8 – 1 = 7. Check! How about 4 colors? We know that should give us 15 towers, and (2^4) – 1 = 16 – 1 = 15. Check check!

Congrats! You’ve finished challenge #1. 

Challenge #2

 Find an expression for the least number of colors needed to make all the towers up to a given height.

If the (2^n) – 1 = the max number of towers for n colors, there should be a way to rearrange the equation to find the minimum number of colors, n, for all towers up to a specified height (let’s call this k). With a little bit of middle-school math, I find that 2^n = k + 1, so then n*log(2) = log(k+1), which means that the least number of colors needed for towers up to k in height should be log(k+1)/log(2).

But wait… won’t that expression give us a fraction the majority of the time? Well, yes, but that has a quick fix. Since you can’t have a fraction of a color, all you have to do is round up to the nearest whole number. Let’s see if it works: we know we need at least 3 colors for up to height 7, so we check log(7+1)/log(2) = a perfect 3 – great! Now, for height 8 and above, we need 4 colors. If we check 8, we end up with log(8+1)/log(2) = 3.17, which, if we round up to the nearest whole number, we get 4 – perfect! 

If you look into the math of it, you’ll realize that numbers 3, 7, 15, 31, etc. (the turning points to a greater number of colors) all give you clean, whole, consecutive numbers, because you’re just finding the power of 2 that gets you to k+1. Every number in between will just round up.

There you go! Challenge #2: completed.

So why does this even matter?

Some of you may be itching for me to say this already: 1, 2, 4, 8, 16… this is the pattern you see when you count in binary! Yes, it’s true. We’ve tricked you into the boring task of counting in binary by masking it with pretty colors – who knew binary could be fun?! For those unfamiliar with how binary works, here’s a quick crash course. 

Our number system is the decimal system, which is base 10. What does that mean? Well, we count using 10 different numbers: 0 – 9. Binary, however, is a base 2 system, so it only uses two numbers: 0 and 1. 

With 2 digits, you can count up to 3, where one is 1, two is 10, and three is 11. In order to get farther, we must add another digit (just as we added another color after height 3 – crazy!), and four becomes 100. If you look at each of the digits in the number as a “column,” you’ll notice that each column indicates the amount of the number in the sequence we found earlier (i.e. the rightmost column is how many 1s, then the next column to the left shows how many 2s, then 4s, etc.). Study the table and examples below to get for a better visual.

But still… you might be thinking, why should I care?

Well, your computer wouldn’t work without it! Computers rely on binary math to make their tasks simpler, since they only have to worry about 2 digits instead of 10. Overall, it increases their efficiency by making it easier to store and manipulate numbers. Not only that, but binary is used to represent and store all kinds of information, including letters, words, and even audio or pictures! Yeah, you’re basically a computer programmer now.

Kidding… all jokes aside though, the binary number system was the foundation for so much of the technology we use today – and now you know it! Pretty cool, huh?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top