How many zeroes do we write when we write all the integers from 1 to 256 in binary?
How many zeroes do we write when we write all the integers from 1 to 256 in binary?
I am going to look for a pattern.
256 = 2^8 so there is 8 zeros which is 9 digits
consider the numbers between 2^1 and 2^2-1 inclusive 10,11, 2/2=1 zeros
consider the numbers between 2^2 and 2^3-1 inclusive 100,101,110,111, 2^2 *2 /2=4 zeros
consider the numbers between 2^3 and 2^4-1 inclusive 4 digits 2^3 *3/2 = 12 zeros
....
consider the numbers between 2^7 and 2^8-1 inclusive 8 digits 2^7 *7/2 zeros
1+4 + 2^3*3/2 + 2^4*4/2 + 2^5*5/2 + 2^6*6/2 + 2^7*7/2 + 8
= 1+4+ 4*3 + 8*4 + 16*5 + 32*6 + 64*7 + 8
= 1 + 4 + 12 + 32 + 80 + 192 + 448 + 8
= 777 base 10
Just as guest already determined :)