1
$\begingroup$

The equation for the number of digits required to express some number (N) given some base (b) is the following

$\lceil{\log_{b}(N+1)}\rceil$

If we want to see the difference in number of digits required for varying bases then then our general formula would be

$\lceil{\log_{b_{1}}(N+1)}\rceil - \lceil{\log_{b_{2}}(N+1)}\rceil$

But I'm not sure how to solve this for some number in terms of N since they have different bases.

This is for a Computer Science algorithms class so approximate answers are fine.

$\endgroup$
  • $\begingroup$ "But I'm not sure how to solve this for some number in terms of N since they have different bases." Not sure how to solve what? So far as I can tell $\lceil{\log_{b_{1}}(N+1)}\rceil - \lceil{\log_{b_{2}}(N+1)}\rceil$ is the answer. If it's not, what is your question? $\endgroup$ – fleablood Sep 11 '19 at 22:26
  • $\begingroup$ The difference in the number of digits required. I just found the solution reading in my textbook so I'll answer my own question in a comment right now $\endgroup$ – financial_physician Sep 11 '19 at 22:33
2
$\begingroup$

To convert from one logarithmic base to another we have the equation

$\log_b(N) = \log_a(N)/\log_a(b)$

Thus the size of the integer is always different by log_a(b) which is a constant.

$\endgroup$
  • 1
    $\begingroup$ You want :"differ by a factor of", not just "different by". Since $2^{10} \approx 10^3$ the base $2$ logarithm of $10$ is just over $3$ so numbers have just over $3$ times as many binary as decimal digits. +1 for answering your own question. You have asked several questions here. When you get answers that help you should upvote them, and accept one. $\endgroup$ – Ethan Bolker Sep 11 '19 at 22:40
  • $\begingroup$ ahhhh, there's the difference that I was neglecting that I should have understood better. Thank you! $\endgroup$ – financial_physician Sep 11 '19 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.