Chapter 18 of 20 · 5 min · 12 questions

Chapter video4:57
Take quiz →

Counting numbers and digits in a range

Some questions ask you to count: how many numbers lie in a range, how many digits a printer uses, how many times the digit 5 is written. Writing out the list is slow and you will miscount. The method is three words: split, count, add. Split the range into parts that are easy to count, count each part, and add the parts.

How many numbers?

From 10 to 99, how many numbers are there? Subtracting gives 99 − 10 = 89, but that leaves out the first number. The rule is:

last − first + 1

So 10 to 99 holds 99 − 10 + 1 = 90 numbers. Three counts follow from this, and they are worth knowing by heart: there are 9 one-digit numbers, 90 two-digit numbers and 900 three-digit numbers.

Read the words of the question. "From 37 to 112" counts both ends: 112 − 37 + 1 = 76. "Between 200 and 300" leaves out both ends: the numbers are 201 to 299, which is 99 numbers.

Digits in a book

UPSC asked in 2017: a book of 150 pages is numbered from 1 to 150. How many digits are printed? Split the pages by the number of digits each one carries.

  • Pages 1 to 9: 9 pages × 1 digit = 9
  • Pages 10 to 99: 90 pages × 2 digits = 180
  • Pages 100 to 150: 51 pages × 3 digits = 153

Total: 9 + 180 + 153 = 342 digits. Note the last block. It has 150 − 100 + 1 = 51 pages, not 50.

From digits back to pages

UPSC asked the reverse in 2019: a printer uses 3089 digits. How many pages? Fill the full blocks first, then divide what is left.

  • Up to page 9: 9 digits. Up to page 99: 9 + 180 = 189 digits.
  • The three-digit pages use 900 × 3 = 2700 digits. Up to page 999: 189 + 2700 = 2889 digits.
  • Left over: 3089 − 2889 = 200 digits. From page 1000, each page takes four digits, so 200 ÷ 4 = 50 more pages.

The last page is 999 + 50 = 1049.

One digit, one place at a time

How many times is the digit 5 written from 1 to 100? Do not scan the numbers. Take one place at a time.

  • Units place: 5, 15, 25 and so on up to 95. Ten times.
  • Tens place: 50 to 59. Ten times.

Total: 20 times. The number 55 has two fives and is counted once in each place, which is right.

From 1 to 1000 (UPSC 2019), the digit 5 sits in the units place 100 times, in the tens place 100 times and in the hundreds place (500 to 599) 100 times. The answer is 300.

Zero behaves differently, because zero is never written in front: 5 is not written as 05. From 1 to 100, zero appears in the units place ten times (10, 20 and so on up to 100) and in the tens place only once (in 100). That is 11 times, not 20.

Count, then subtract

UPSC 2020: how many integers between 1 and 100 have 4 as a digit but are not divisible by 4?

Step 1: count the numbers that have a 4. Ten have it in the units place (4, 14 and so on up to 94). Ten have it in the tens place (40 to 49). The number 44 is in both lists, so the count is 10 + 10 − 1 = 19.

Step 2: take away the ones that 4 divides: 4, 24, 40, 44, 48, 64 and 84. That is 7 numbers.

Answer: 19 − 7 = 12.

The same splitting works for a property of the digits. UPSC 2018 asked how many numbers from 700 to 1000 have their digits in decreasing order. Split by the hundreds digit. With 7 in front, a tens digit of 1 allows one units digit (0), a tens digit of 2 allows two, and so on up to 6: 1 + 2 + 3 + 4 + 5 + 6 = 21. With 8 in front the count is 28, and with 9 in front it is 36. Total: 85.

The method in one table

The question asksSplit byExample
How many numbers from a to bnothing: last − first + 110 to 99: 90 numbers
Digits used to number pagesnumber of digits: 9, 90, 900 pages150 pages: 9 + 180 + 153 = 342
Pages from a digit totalfull blocks 9, 180, 2700, then divide the rest3089 digits: 999 + 50 = 1049
Times a digit is writtenplace: units, tens, hundreds5 from 1 to 1000: 300
Numbers with a propertyplace, then subtract the overlapa 4 in 1 to 100: 10 + 10 − 1 = 19

Where students slip

  • Forgetting the plus one. Pages 100 to 150 are 51 pages. This single slip turns 342 into 339.
  • Not reading "between". Between 99 and 1000 means 100 to 999. From 99 to 1000 would add two more numbers.
  • Mixing two different questions. "How many times is 7 written from 1 to 100" is 20. "How many numbers from 1 to 100 contain a 7" is 19, because 77 is one number with two sevens.
  • Dividing the whole total. In the 3089 question, dividing 3089 by 4 is wrong. Only the leftover 200 digits belong to four-digit pages.
  • Ignoring the range. In all two-digit numbers, 5 is written 19 times, not 20: the single-digit 5 is outside the range.

How to practise

Learn the block totals 9, 180 and 2700, and the running totals 189 and 2889. Then set yourself small questions and check them by actually listing. Count the digits for a book of 60 pages, then 250 pages. Count the numbers from 1 to 100 that contain a 9. When your quick count and your list agree every time, stop listing. In the exam, write the split on paper as two or three short lines, one for each part, and then add.

Save your reading and sit the 9 PM all-India test.

Sign up