A teacher wrote all the numbers from 1 to 31 in binary form. Find total number of 1’s that are there on the board?
Explanation:
(1)10 = (1)2 (31)10 = (11111)2
∴ we need to calculate number of 1’s used in all the numbers in base 2 up till 11111.
Single-digit numbers: 1
2-digit numbers: 2 + 1 = 3
3-digit numbers: 4 + 2 + 2 = 8
4-digit numbers: 8 + 4 + 4 + 4 = 20.
5-digit numbers: 16 + 8 + 8 + 8 + 8 = 48.
∴ Total number of 1’s used = 1 + 3 + 8 + 20 + 48 = 80.
Hence, 80.
» Your doubt will be displayed only after approval.
Help us build a Free and Comprehensive Preparation portal for various competitive exams by providing us your valuable feedback about Apti4All and how it can be improved.