So many twos

How many times will the digit 2 be used in numbering 250 pages of a book? (The page number starts from 1)


The answer is 106.

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.

4 solutions

Discussions for this problem are now closed

Greg Johnson
Dec 30, 2014

I counted where the 2's will be occurring.

In the 1's position, a 2 will occur 1 time in each 10, so 25 times from 1 - 250. (2, 12, 22, 32... 242). In the 10's position, a 2 will occur 10 times in each 100, so 30 times in 3 batches: the 20's, the 120's and the 220's. In the 100's position, a 2 will occur 100 times in each 1000. In this case, however, our max number to count to is 250, so the 2 occurs only 51 times: 200, 201 ... 250.

A small gotcha is in the boundary condition of the 2's in the 100's position (not 50 but 51 occurrences)

FIRST COUNT THE NUMBERS WITH 2 IN ONES DIGIT - 25, 2 IN TENS DIGIT - 35, 2 IN HUNDREDS DIGIT - 51, THE TOTAL IS 106

Chih-Chiun Chang
Jan 1, 2015

A unique possible way to think about this is to move backwards. I see people counting upwards in the two solutions by Greg and Aditya, but sometimes with larger values it is useful to move backwards. Starting from 250, you subtract 50 from the 200-250 numbers and an additional "minus 1" for each number with multiple 2's. You don't deal with multiple 2's from 100-199 and 0-99, so you subtract an equal amount of 20 from each category (11 from 20-29 and 8 for each other place change).

Hi Chih-Chiun, I'm struggling to understand your method here. Can you please re-explain it? You start with 250, and then are you subtracting numbers without a "2" in it, leaving you with the result?

Greg Johnson - 6 years, 5 months ago

I do not get it. My calculations give 111.

Making a table

Page no range No of 2's Remark
1-9 1 2
10-19 1 12
20-29 11 20,21,22,..,29
30-99 7 32,42,..,92
100-199 1+1+11+1+7=20 Same as 1-99
200-250 51+20=71 2 in 100's place also

So the total comes to 111, where is the mistake made?

Janardhanan Sivaramakrishnan - 6 years, 3 months ago

The mistake is in the last line. The "+20" is wrong.

Fabio Gama - 6 years, 3 months ago
Aditya Vikram
Dec 30, 2014

FROM 1-100 , THERE WILL BE TWENTY 2's, FROM 101-200, THERE WILL BE TWENTY ONE 2's AND FROM 201-250 THERE WILL BE SIXTY FIVE 2's.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...