There is a formula to convert a decimal number into another base. In below example, we use decimal 255 and we divide it by the base, which could be base 16 or base 2 or another. The first question mark is result of division and the second question mark is the remainder:
255 = ? * b + ?
You continue to repeat this process until dividing the decimal number by base returns a 0.
I tried this with multiple bases and it works regardless of what base I use:
16:
255 = 15 * 16 + 15
15 = 0 * 16 + 15
2:
255 = 127 * 2 + 1
127 = 63 * 2 + 1
63 = 31 * 2 + 1
31 = 15 * 2 + 1
15 = 7 * 2 + 1
7 = 3 * 2 + 1
3 = 1 * 2 + 1
1 = 0 * 2 + 1
What makes this formula work for all bases? I know the formula but I don't see why it works for all bases.