Please show me the steps you would use to convert the hexadecimal number 42B13_16 = 0x42b13 to base 18. (To my knowledge, the answer is: 42B13_16 = 2AF23_18.)
So the number is 273171 is decimal (works easier for me... I'm not yet fluent in base 16). Next, find the largest power of 18 that still fits within that number (which is 18^4 is this case. 18^5 is too large). Next, we do an integer division with 18^4. The result is the first digit and we'll continue with the remainder. The steps are: 273171 / (18^4) = 2 273171 % (18^4) = 63219 63219 / (18^3) = 10 = a 63219 % (18^3) = 4899 4899 / (18^2) = 15 = f 4899 % (18^2) = 39 39 / (18^1) = 2 39 % (18^1) = 3 3 / (18^0) = 3 Therefor, 273171 (base 10) is the same as 2af23 (base 18), like you said.
There are also other methods. The one I prefer (as long as I don't forget it) is the following: Keep dividing the number by 18 and the remainder are your digits (in reverse order). Let's do it with 273171 to make it more clear: 273171 % 18 = 3 (273171 / 18 = 15176) 15176 % 18 = 2 (15176 / 18 = 843) 843 % 18 = f (843 / 18 = 46) 46 % 18 = a (46 / 18 = 2) 2 % 18 = 2 So the number is 2af23 (base 18)
Thanks for both answers. I appreciate it very much. :)
Join our real-time social learning platform and learn together with your friends!