# Number of digits in different number systems?

I know a similar question was asked before, but I wanted to know if this can be extended to any number system by a generic formula.

For example, given a number X in number system A, how many digits would it have in number system B? I'm looking for a sort of universal formula in terms of X, A and B.

Thanks

As J. M. said in a comment to the question you ask, an integer $X$ has $\lfloor 1+\log_B X\rfloor$ base-$B$ digits. Going from base $A$ to base $B$ the number of digits is multiplied by $\frac{\log A}{\log B}$ but that is approximate due to the 1 and the floor function.

• I apologize if this seems trivial but I'm unable to use it in an example. Let's say I have a decimal number of 100 digits and I want to find how many bits it would have. Would that be (approximately) 100 * log(2)/(log 10)? – David Feb 23 '11 at 15:00
• I had a typo, now fixed. It should be 100*log(10)/log(2). You can check with smaller numbers. A three digit number ranges from 100 to 999. In base 2 this ranges from 7 to 10 bits. And log (10)/log(2) is about 1/.30103=3.32 – Ross Millikan Feb 23 '11 at 15:12