Repeating digits

How many positive numbers up to and including 2016 have at least one repeating digit?


The answer is 770.

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.

2 solutions

Patrick Heebels
Jan 10, 2016

Let's see how many positive numbers from 1 up to and including 2016 have no repeating digits.

Let d n d_n be the n t h n^{th} digit of the number.

1 digit numbers:

All 9 single digits numbers have no repeating digits.

2 digit numbers:

d 1 { 1 , 2 , . . . , 9 } d_1 \in \{1, 2, ..., 9\} and d 2 { 0 , 1 , . . . , 9 } d_2 \in \{0, 1, ..., 9\} but different from the first.

So a total of 9 × 9 = 81 9 \times 9 = 81 two-digit numbers have no repeating digits.

3 digit numbers:

d 1 { 1 , 2 , . . . , 9 } d_1 \in \{1, 2, ..., 9\} and d 2 { 0 , 1 , . . . , 9 } d_2 \in \{0, 1, ..., 9\} but different from the first and d 3 { 0 , 1 , . . . , 9 } d_3 \in \{0, 1, ..., 9\} but different from the first and second.

So a total of 9 × 9 × 8 = 648 9 \times 9 \times 8 = 648 three-digit numbers have no repeating digits.

4 digit numbers starting with 1:

d 1 = 1 d_1 = 1 and d 2 { 0 } { 2 , . . . , 9 } d_2 \in \{0\} \cup \{2, ..., 9\} and d 3 { 0 } { 2 , . . . , 9 } d_3 \in \{0\} \cup \{2, ..., 9\} but different from the second and d 4 { 0 } { 2 , . . . , 9 } d_4 \in \{0\} \cup \{2, ..., 9\} but different from the second and the third.

So a total of 1 × 9 × 8 × 7 = 504 1 \times 9 \times 8 \times 7 = 504 four-digit numbers have no repeating digits.

4 digit numbers starting with 2 (up to 2016):

Only 2013, 2014, 2015 and 2016 have no repeating digits.

Conclusion: In total 2016 9 81 648 504 4 = 770 2016 - 9 - 81 - 648 - 504 - 4 = 770 positive numbers from 1 up to 2016 have at least one repeating digit.

Solomon Olayta
Jan 18, 2016

The trick is to count the numbers without repeating digits then subtract it from 2016. Clearly, there are 9 1-digit number without repeating digits. There are 2 ( 10 2 ) 9 = 81 2 \binom{10}{2}-9=81 two-digit numbers without repeatition. There are 3 ! ( 10 3 ) 2 ( 9 2 ) = 648 3!\binom{10}{3}-2\binom{9}{2}=648 three-digit numbers without repeatition. If the thousands digit is 1, there are 3 ! ( 9 3 ) = 504 3!\binom{9}{3}=504 four-digit numbers without repeatition. When the thousands digit is 2, there are 4 such numbers, namely 2013,2014, 2015, 2016. Hence, there are 504 + 4 = 508 504+4=508 four-digit numbers less than or equal to 2016 without repeating digits. Therefore, the number of integers from 1 to 2016 including 1 and 2016 with repeating digits is given by 2016 ( 9 + 81 + 648 + 508 ) = 770 2016-(9+81+648+508)=\boxed{770}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...