Tuesday, February 11

Color Coding (both types)

When you hear the words 'color' and 'coding' together, you think of moms and control freaks, right? Well, in computer coding, there's actually a way of making every single color, sprinkled right in with set theory and hexadecimals.

When you want to express a color in coding, you use the amounts of Red, Blue, and Green. Therefore they call it the RGB Color System.

In coding, there are 255 different levels of each specified color. Since 256 is the square of 16, hexadecimal is the way to go in actually expressing the colors for the computer to register, convert, and show.

For the final input, you get a six digit number with some digits represented by letters from A through H. Basically, each color gets two digits to express its level. Examples:

#FF7000 is UVA ORANGE
#FF66FF is BREAST CANCER AWARENESS PINK
#00FF00 is MY FAVORITE COLOR (try to out what color this is! Don't cheat!)



Continuing a color streak, here's a problem about colors.

Let's say there are 8 red socks (#FF0000), 10 gray socks (#888888), 12 purple socks (#9933CC), and 14 white socks (#FFFFFF) in a drawer, all individually separated into a random pile. You just need a pair of socks–– any color, as long as they match color. However, either the lights or off or you're blind because you can't see what color each sock is. How many socks do you have to grab in order to make sure you get at least one match? How about 2?

Because you have to make absolutely sure, you think of the worst possible scenario, like all the color-coding control freaks at home. The worst possible scenario is that you'd get one of each sock. However, you need one pair, so you can add one and get 5 socks. As for two, you do the same thing: one from each of three colors and three of the last. Add one to get 7.


You  want a pair of white socks, two pairs of gray socks, and a pair of red socks from that same drawer (and by the way, you put back the ones you took out). How many pairs do you have to pull out, at least?

This is basically the same idea: worst possible scenario and add one. Logically, you can get all of the purple socks without getting a correct pair at all. Since you want to have the most possible socks, you should get all of the white and gray socks too, and one red sock. That would give you 38 socks (by the way, you could also get all red, purple, and white socks and then 4 gray socks for the same answer).


Have a 'colorful' day in paradise...

Stay cool,
John

3 comments:

  1. John, your favorite color is green.

    Also, in case you didn't know, the phenomenon you're describing in the second half of your post is based on something called the "pigeonhole principle." It can be used to show that, at any given time, there are two people in New York City with the exact same number of hairs on their heads! There are lots of fun things that come from the pigeonhole principle, so you should look them up if you're interested. (It's also particularly useful when dealing with infinitely large sets).

    ReplyDelete
    Replies
    1. You're right about the color, Chris! Your prize is... me saying congrats!

      Also, thanks for the 'pigeonhole principle' concept. That's cool, but it has a really weird name (coincidentally, you pointed out New York later in your comment).

      Delete
    2. John, what do you mean by Chris' mentioning New York being concidental? Do you associate New York with pigeons, or something?

      Well, I am really impressed by your blog! You are way past me, bud! (I had to get Chris to explain the color coding. It is way cool, now that I get it!)

      Seeing your blog reminds me of one of Charlie's baseball coaches from years passed. His name is Pete Fader and he teaches at the Wharton School at UPenn, and he is really into numbers. He has a website that maybe you'd like to check out: coolnumbers.com.
      Keep up the fun math work, John... someday you'll be a famous mathematician!

      Delete

Comment if you dare