Why doesn't this base 10 number mod a power of 2 work?

caters

New member
Joined
Mar 1, 2014
Messages
24
Okay I tried to convert 1 million to binary by dividing by a power of 2 and taking the remainder and dividing that by a power of 2 and so on and I got this:
1111010000100100000
Google says 1 million in binary is:
11110100001001000000

Why is mine with the modular arithmetic 19 bits and the google search for 1 million in binary coming up with 20 bits? Do they take it 1 step further to the half's place or something?

I mean modular arithmetic should work for converting any base 10 number to that same number in binary. How would it work for base 3 and larger though since you have more digits you can use in those bases.
 
Last edited:
thats what google says to but I didn't get that with my mod 2^x until there is no remainder.
 
You can divide 1000000 by 2, six times, before you get a remainder of one. That means that the six least significant digits of 1000000 in base 2 are ZERO.
 
Okay I see I must have forgotten that 2^0 digit which is needed when I was dividing it by smaller and smaller powers of 2.
 
Top