There was a mistake in my previous answer: look at Ben Schwen's comment. Sorry for the confusion, I found and explained the error I made in my previous answer below.
Please use the answer provided by Paul Tomblin. (rewritten to use P, Q and n)
Y = ln(P^n) / ln(Q) Y = n * ln(P) / ln(Q)
So, Y (rounded) is the number of characters you need in the Q system to express the largest number that you can encode in n characters in the P system.
I have no answer (which will not convert the number already and take up so much space in the temporary variable) in order to get the minimum minimum for the given number 1000 (bin) = 8 (dec) while you reserve 2 decimal positions using this formula.
If using temporary memory is not a problem, you can cheat and use (Python):
len(str(int(otherBaseStr,P)))
This will give you the number of decimal places needed to convert the number in base P other than the string (otherBaseStr) to decimal numbers.
Old WRONG answer:
If you have a number in a system with numbers P of length n then you can calculate the largest number that is possible in n characters:
P^(n-1)
To express this highest number in the Q number system, you need to use logarithms (because they are the inverse of exponentiation):
log((P^(n-1))/log(Q) (n-1)*log(P) / log(Q)
For example, 11000000 in binary format is 8 characters. To get it in the decimal system, you will need:
(8-1)*log(2) / log(10) = 2.1 digits (round up to 3)
The reason is wrong :
The maximum number that is possible in n characters is
(P^n) - 1
not
P^(n-1)