Find the sum of all 16-bit numbers , whose representation in the octal and hexadecimal systems contain only 1's and 0's.
Example: [ has no 1's or 0's in its representations in both octal and hexadecimal.]
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.
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: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 = 0 0 0 0 1 6 = 0 0 0 0 0 8 = 0 1 0 ; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 = 0 0 0 1 1 6 = 0 0 0 0 1 8 = 1 1 0 ; 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2 = 1 0 0 0 1 6 = 1 0 0 0 0 8 = 4 0 9 6 1 0 ; 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 2 = 1 0 0 1 1 6 = 1 0 0 0 1 8 = 4 0 9 7 1 0 .
The question only asks for integers greater than one, we add 4 0 9 6 + 4 0 9 7 = 8 1 9 3 .