Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A set $S$ is defined as $S = \{3,6,9,\ldots,1002\}.$
How many times does digit three appear in the decimal representations of members of $S$?

I have solved this question by seeing pattern like $3, 6, 9$, but is there a general solution?

share|cite|improve this question
by general solution, you mean for like any digit? for any range for the set? – mathguy Aug 18 '12 at 16:22
yes for any digit – Arpit Bajpai Aug 19 '12 at 3:54
up vote 2 down vote accepted

Hint: how many numbers are in the set? How many 3's appear in the units place? In the tens place?

share|cite|improve this answer

We should count all 3 digits. We will suggest that all numbers in your set have 3 digits: (003, 006,009, 999). "3" appears in the last position every 10 times, starting from the first number of set. (Because of cycle (3,6,9,2,5,8,1,4,7,0,3)). So we have 34 "3" in the last position. And it is very clear that in the first position "3" appears 34 times. If "a" is on the first position and a+3=3m+r: if r=0 then "3" appears on the second position 4 times and 3 times in other cases. This give us, that when "0,3,6,9" in the first position, we have "3" 4 times on the second position and 3 times in other cases. It give us 4·4+6·3=34 "3" on the second place. So we have total 34+34+34=102 digits "3" in your set.

May be there are more simple solution.

ps. For the Set $ \{3,6,..., 10^n-1 \}$ on each place we have $[\frac{10^n}{3}]+1$ digits "3". So we have total $n \cdot \left([\frac{10^n}{3}] +1) \right) $ digits "3".

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.