Only 1's and 0's counts

Find the sum of all 16-bit numbers > 1 > 1 , whose representation in the octal and hexadecimal systems contain only 1's and 0's.

Example: [ 2018 2018 has no 1's or 0's in its representations in both octal and hexadecimal.] in base 8 , 201 8 10 = 374 2 8 in base 16 , 201 8 10 = 7 E 2 16 \text {in base} \ \ \ 8 , \ \ 2018_{10} = 3742_8 \\ \text {in base} \ \ 16 , \ \ 2018_{10} = 7E2_{16}


The answer is 8193.

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.

1 solution

If a number contains only 0s and 1s in the octal system, all bits must be zero except possibly bits 0, 3, 6, 9, etc.

If a number contains only 0s and 1s in the hexadecimal system, all bits must be zero except possibly bits 0, 4, 8, 12 etc.

If both are the case, the only non-zero bits may be bits 0, 12, 24, ...

Since we are talking 16-bit numbers here, we must have all bits zero except possibly bits 0 and 12. This allows for four integers: 0000 0000 0000 000 0 2 = 000 0 16 = 0000 0 8 = 0 10 ; 0000 0000 0000 000 1 2 = 000 1 16 = 0000 1 8 = 1 10 ; 0001 0000 0000 000 0 2 = 100 0 16 = 1000 0 8 = 409 6 10 ; 0001 0000 0000 000 1 2 = 100 1 16 = 1000 1 8 = 409 7 10 . 0000\,0000\,0000\,0000_2 = 0000_{16} = 00000_8 = 0_{10}; \\ 0000\,0000\,0000\,0001_2 = 0001_{16} = 00001_8 = 1_{10}; \\ 0001\,0000\,0000\,0000_2 = 1000_{16} = 10000_8 = 4096_{10}; \\ 0001\,0000\,0000\,0001_2 = 1001_{16} = 10001_8 = 4097_{10}.

The question only asks for integers greater than one, we add 4096 + 4097 = 8193 4096 + 4097 = \boxed{8193} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...