2 0 1 0 = 1 0 1 0 0 2 = 1 0 1 0 0 − 2
Today, modern mathematics uses what is known as the decimal number system to write out large numbers. This means that when we write our numbers, we do so by thinking in powers of 1 0 . For example, the number 2 3 4 is really 2 × 1 0 2 + 3 × 1 0 1 + 4 × 1 0 0 .
While the number 1 0 is the norm used around the world, numbers can really be written in any base. Take our example of 2 3 4 from above. It can be written as 4 × 7 2 + 5 × 7 1 + 3 × 7 0 , meaning that it's base 7 representation is 4 5 3 7 . The subscript 7 denotes that the number is not in base 10, as to avoid confusion.
Not only can numbers be written in positive bases, but in negative bases as well! The example that can be seen at the top of the problem shows the conversion of the number 2 0 to Base 2 , known as binary , and Base − 2 , known as negabinary . As you can see, its representation is the same in both bases, but this is not the case with all numbers. For example, 7 = 1 1 1 2 = 1 1 0 1 1 − 2 . How many positive integers n < 1 0 0 0 have the same representation in both binary and negabinary?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Great job, this was the intended solution.
Log in to reply
But sir, some natural numbers do include zero.
Log in to reply
I've edited the question to say "positive integers" rather than "natural numbers" to avoid confusion. Thank you!
Amended the solution to clarify the wording "natural number". I agree with Kenny, the problem would benefit from being more explicit, e.g. n is an integer such that 0 < n < 1 0 0 0 .
Log in to reply
@Dan Wilhelm – Well, I firstly inputted 32, thought a long while, couldn't find any mistakes, but tried 16 either way, and then guessed 31 because maybe there are some special cases, and then got it right.
You need to show that all numbers in the form n 8 0 n 6 0 n 4 0 n 2 0 n 0 2 are less than 1 0 0 0 (so they are counted). Had the problem state something like n < 3 0 0 instead, some of the numbers wouldn't be counted (for example 3 2 0 = 1 0 1 0 0 0 0 0 0 2 = 1 0 1 0 0 0 0 0 0 − 2 is no longer counted).
Only the bits in the even locations will contribute to the solution. These bits are bits 0,2,4,6,8. Max no. that can be written in these 5 bits is = 341.
So, there are only Five bits that satisfy the required condition of this problem, and the solution is 2 5 − 1 = 3 1 .
Problem Loading...
Note Loading...
Set Loading...
We are asked how many positive integers n < 1 0 0 0 1 0 = 1 1 1 1 1 0 1 0 0 0 2 have equivalent binary and negabinary representations. We can represent each of these numbers as a 10-bit sequence N = { n 9 , n 8 , . . . , n 0 } , where n i ∈ { 0 , 1 } . We define the binary representation of N and the negabinary representation of N respectively as follows:
i = 0 ∑ 9 n i ⋅ 2 i , and i = 0 ∑ 9 n i ⋅ ( − 2 ) i .
Let a ∈ N . When i = 2 a is even, each negabinary term is equivalent to the binary term, since ( − 2 ) 2 a = 4 a = 2 2 a . When i = 2 a + 1 is odd, the negabinary term is the additive inverse of the binary term, since ( − 2 ) 2 a + 1 = − 2 ⋅ 2 2 a = − ( 2 2 a + 1 ) . Hence, for a particular sequence N , the negabinary representation is equivalent only when each odd bit is 0 ; otherwise, it is less than the binary representation.
Since each odd bit must be 0 , we are left with five bits that can be either 0 or 1 : { n 0 , n 2 , n 4 , n 6 , n 8 } . So, there are 2 5 = 3 2 unique sequences. Excluding zero, there are 2 5 − 1 = 3 1 equivalent representations.