Thursday, December 8, 2011

Challenge 031

the decimal notation of (238, 9, 63) is equal to the hexadecimal of 0E14FF. 

To start, hexadecimal numbers have a base of 16. when a number is in decimal form, you are to divide each number that you are given by a denominator of 16.

The first number is 14 so it is 14/16. Since the number is less than 1, you add 0 to the beginning of the answer because it doesnt effect the answer. 14/16= 0+ 14/16. We only look at the numerator when converting. Since the numerator is in between 10 and 15, it takes a value between A-F (For example, 10=A 11=B 12=C 13=D 14=E 15=F). So, the first value of the hexadecimal code is 0 because we added 0 to 14/16 and the second character would be E because 14 corresponds to it.

Next, we divide 20/16 which is equal to 1 and 1/4. We take the number left of the decimal first so the next value of the hexadecimal is 1. Since we use a base of 16, 1/4 equals 4/16. Value 0-9 equal themselves when converted (For Example, 0=0 1=1 2=2...9=9). so the next value of the code is 4.

Lastly, we divide 255/16 and get 15 and 15/16. since the number left of the decimal is between 10 and 15, it takes a letter value which happens to be F. Then we take the value to the right of the decimal which is 15/16 and because it is between 10 and 15, it takes a letter value which happens to be F.

So, the code converts to 0E14FF.