I know base 13 is not practical. However, i was checking out The Hitchhiker’s Guide to the Galaxy again because todays date is 10/10/10 = 42 in binary. (you know, the answer to the ultimate question of life, the universe, and everything) It takes Deep Thought 7½ million years to compute and check the answer, which turns out to be 42. Unfortunately, The Ultimate Question itself is unknown. Anyways, he said “”Six by nine. Forty two.” “That’s it. That’s all there is.””I always thought something was fundamentally wrong with the universe”
My question is how is 6 x 9 in base 13 = 42?
I know how to convert base 10, 2,16,8 but going from base 10 to base 13 is a mystery to me.
I understand that in base 13 that 6 probably =6 and 9 probably =9 S0, it is just a matter of multiplying in base 13?
Can someone work it out?
I have found this but doesnt help much
in base 13, 6 13 × 9 13 is actually 4213
(as 4 × 13 + 2 = 54, i.e. 54 in decimal is
equal to 42 expressed in base 13).
This is a method that can convert a base-10 number to base-13:
Start with a number 9×6=54, we want to find the equivalent of 54 in base 13.
and we concatenate the remainders, from bottom-up, 42.
A more general algorithm, start with a decimal number N, we want to find the equivalent of N in base B.
and concatenate the digits, bottom-up: rn . … . r2 . r1
an iterative implementation in Python:
a recursive implementation in Python:
even more generally, if you have a string representing a number in base N and you want to convert it to a string representing the number in base M: