# Solution

I get 180 as the answer. I don't know whether that's correct. Please correct me if I am wrong. The explanation looks very long, and you might think it would be better to write down all the numbers from 400 to 599 and count the number of eights. But believe me, the explanation is only wordy; when you sit down to solve it, you can solve it in a few steps. I solved it the following way:

Let's split the numbers into two ranges: 400-499 and 500-599.

Let's try to determine the number of fours in both these ranges.

Consider the first range: 400-499. The numbers in this range are in the form of 4**, where the first digit is 4; the remaining two digits can take values from 0 to 9. We have to consider three cases:

• a) The first digit is 4, but none of the other two digits is 4
• b) The first digit is 4, and one of the other two digits is 4
• c) The first digit is 4, and both of the other two digits are also 4.
• a) The numbers in the form of 4** have four as the first digit, but none of the other two digits is 4. In other words, these are numbers with only one 4 in them. The ten's digit can take any value from 0 to 9, except 4. So, there are nine choices. Similarly, the unit's place can take nine values (it also cannot be 4). So, there are 9 × 9 = 81 numbers with four as the first digit, and none of the other two digits is 4. How do you get 81 numbers? Well, the first digit is 4. Let's start with the second digit as 0. The third (unit's) digit can take nine values from 0-9 except 4. So, you get nine numbers: 400, 401, 402, 403, 405, 406, 407, 408, and 409. If the second digit is 1, and the unit's digit takes values from 0-9 except 4, we get 410, 411, 412, 413, 415, 416, 417, 418, and 419. Again, we have nine numbers. When the second digit takes the values 2, 3, 5, 6, 7, 8, and 9, we get nine numbers in each case. So, there are a total of 81 numbers with only one 4. Eighty-one numbers have one four in them. Therefore, the total number of fours in the case of these 81 numbers = 81.

b) The numbers in the form of 4** have four as the first digit, and one of the other two digits can be 4. In other words, these numbers can be in the form of 44* or 4*4. The * can take values from 0 to 9 except 4. It means, star (*) can be 0, 1, 2, 3, 5, 6, 7, 8, or 9. There are nine choices. So, there are nine numbers in the form of 44* and nine numbers in the form of 4*4. Therefore, 9 + 9 = 18 numbers have two fours in them. Eighteen numbers have two fours in them, so the total number of fours in these 18 numbers = 2 × 18 = 36.

c) Lastly, consider 4** where all the digits are 4s. There is only one such number: 444. It has three fours in it.

Therefore, the total number of fours occurring in the range 400-499 = 81 + 36 + 3 = 120.

Now, we consider the range 500-599. The numbers in this range are in the form of 54*, or 5*4, or 544, where * can take values from 0 to 9 except 4. Let's consider each of these cases:

The star (*) in 54* has nine choices. So, there are nine numbers in the form of 54*: 540, 541, 542, 543, 545, 546, 547, 548, and 549. Each of them has only one 4. So, there are a total of nine fours. Similarly, there are nine numbers in the form of 5*4; each has only one 4. So, there are a total of nine fours. The numbers in the forms of 54* and 5*4 together have 9 + 9 = 18 fours.

There is only one number in the form of 544, and it has two fours.

So, the total number of fours in the range 500-599 = 18 + 2 = 20.

Therefore, the total number of fours in the range 400-599 = 120 + 20 = 140.

The boy has mistakenly written all these fours as eights. But, he has also written the eights as they are. So, we have to find the total number of eights in the range 400-599.

As before, let's consider the ranges 400-499 and 500-599.

f) In the range 400-499, the first digit is 4. So, the numbers with a single 8 in them will be in the form of 48* or 4*8. There are nine choices for each. So, the total number of eights is 9 + 9 = 18.

The range 400-499 can have only one number with two 8s. It is 488. It has two eights.

Therefore, the total number of eights in the range 400-499 = 18 + 2 = 20.

Now, we have to find the number of eights in the range 500-599. The numbers start with 5, so the numbers with a single 8 in them can be in the form of 58* or 5*8. There are nine choices for each of them. So the total number of eights is 9 + 9 = 18. Similarly, the only number with two eights is 588. So, the total number of eights in this range = 20. Therefore, the total number of eights in the range 400-599 = 20 + 20 = 40.

So, the total number of eights written by the boy = 140 + 40 = 180.

Psst, I have discovered an easier way to solve the problem. I used MS Word to do it. Just type out numbers from 400 to 599. Find and replace all the 4s with 8s. After that, replace all the 8s with, say, x. You will get a notification telling you how many replacements have been made; that, of course, is the total count of 8s.

• Union Public Service Commission - www.upsc.gov.in
• IIT-Kharagpur - www.iitkgp.ac.in
• Indian Statistical Institute - www.isical.ac.in
• Indian Institute of Technology Madras - www.iitm.ac.in
• Indian Institute of Management, Ahmedabad - www.iimahd.ernet.in
• Indian Institute of Mass Commission - www.iimc.nic.in
• IIT Bombay - www.iitb.ac.in