Binary and Decimal

Don't have 100 hours, or answered your question yourself? Ask for help and post your answers here!
Post Reply
User avatar
Damasta
Posts: 361
Joined: Tue Apr 14, 2009 10:14 am
Location: Provost, UT

Binary and Decimal

Post by Damasta »

I was going to ask:

"Is there a point at which numbers in binary have fewer digits than the same number in decimal? If so, what is the smallest such positive integer?"

I actually had it all typed up and was going to hit submit, but I worried that the answer would be embarrassingly simple (which it turned out to be). So I decided to do a quick check before I hit "submit". I used Excel to quickly generate a list of 2^2 to 2^200 (for decimal, since a new binary digit is added for every doubling) and 10^2 to 10^200 (for decimal since a new decimal digit is added for every factor of ten). Just looking at those annotations makes it obvious. But I went ahead and looked at the numbers. Also obvious. As a last check, I created a line graph of the two number sequences and set the y-axis to logarithmic scale. Lo and behold the two lines shall never cross.

So, the answer is: No. (And the second question needn't be answered). The closest you can get is 1, which has a single digit in both binary and decimal. And the same goes for 0.
dzhonatan
Posts: 31
Joined: Mon Aug 24, 2009 12:56 pm
Location: Here and there

Post by dzhonatan »

That's because the number of digits in a positive integer x is floor(log(whatever base you're working in) (x))+1. A number in binary will have approximately log2(10) = 3.32192809 times as many digits as the same number in decimal. Obviously, the approximately is only really good for numbers with a lot of digits. 2^20, for example, has 21 digits in base 2, but only 7 in base 10 (1,048,576).
User avatar
Damasta
Posts: 361
Joined: Tue Apr 14, 2009 10:14 am
Location: Provost, UT

Post by Damasta »

Like I said, embarrassingly simple.
I am Ellipsissy...
Post Reply