Difference between revisions of "2004 AIME II Problems/Problem 4"

m (Solution: split up long list, disrupting screen)
m (Solution)
 
(6 intermediate revisions by 6 users not shown)
Line 7: Line 7:
 
Now, let's count those with two distinct digits.  We handle the cases "0 included" and "0 not included" separately.
 
Now, let's count those with two distinct digits.  We handle the cases "0 included" and "0 not included" separately.
  
There are <math>9 \choose 2</math> ways to choose two digits, <math>A</math> and <math>B</math>.  Given two digits, there are <math>2^n - 2</math> ways to arrange them in an <math>n</math>-digit number, for a total of <math>(2^1 - 2) + (2^2 - 2) + (2^3 -2) + (2^4 - 2) = 22</math> such numbers (or we can list them: <math>AB, BA, AAB, ABA, BAA, ABB, BAB, BBA, AAAB, AABA, ABAA,</math> <math>BAAA, AABB, ABAB, BAAB, ABBA, BABA, BBAA, ABBB, BABB, BBAB, BBBA</math>).  Thus, we have <math>{9 \choose 2} \cdot 22 = 36\cdot22 = 792</math> numbers of this form.
+
There are <math>{9 \choose 2}</math> ways to choose two digits, <math>A</math> and <math>B</math>.  Given two digits, there are <math>2^n - 2</math> ways to arrange them in an <math>n</math>-digit number, for a total of <math>(2^1 - 2) + (2^2 - 2) + (2^3 -2) + (2^4 - 2) = 22</math> such numbers (or we can list them: <math>AB, BA, AAB, ABA, BAA, ABB, BAB, BBA, AAAB, AABA, ABAA,</math> <math>BAAA, AABB, ABAB, BAAB, ABBA, BABA, BBAA, ABBB, BABB, BBAB, BBBA</math>).  Thus, we have <math>{9 \choose 2} \cdot 22 = 36\cdot22 = 792</math> numbers of this form.
  
 
Now, suppose 0 is one of our digits.  We have nine choices for the other digit.  For each choice, we have <math>2^{n - 1} - 1</math> <math>n</math>-digit numbers we can form, for a total of <math>(2^0 - 1) + (2^1 - 1) + (2^2 - 1) + (2^3 - 1) = 11</math> such numbers (or we can list them: <math>A0, A00, A0A, AA0, A000, AA00, A0A0, A00A, AAA0, AA0A, A0AA</math>).  This gives us <math>9\cdot 11 = 99</math> numbers of this form.
 
Now, suppose 0 is one of our digits.  We have nine choices for the other digit.  For each choice, we have <math>2^{n - 1} - 1</math> <math>n</math>-digit numbers we can form, for a total of <math>(2^0 - 1) + (2^1 - 1) + (2^2 - 1) + (2^3 - 1) = 11</math> such numbers (or we can list them: <math>A0, A00, A0A, AA0, A000, AA00, A0A0, A00A, AAA0, AA0A, A0AA</math>).  This gives us <math>9\cdot 11 = 99</math> numbers of this form.
  
Thus, in total, we have <math>36 + 792 + 99 = 927</math> such numbers.
+
Thus, in total, we have <math>36 + 792 + 99 = \boxed{927}</math> such numbers.
 +
 
 +
== Solution 2 ==
 +
 
 +
We use casework on the number of digits for this problem.
 +
 
 +
If the number has a single digit, namely the number <math>n \in [1,9],</math> we can clearly all such <math>n</math> work.
 +
 
 +
If the number has two digits, or the number <math>n \in [10,99]</math> we can clearly see all such <math>n</math> work.
 +
 
 +
If the number <math>n</math> has three digits, there are a total of <math>900</math> three digit numbers, and there are <math>9 \cdot 9 \cdot 8</math> numbers that have all distinct digits so there are <math>900 - 9 \cdot 9 \cdot 8</math> total three digit numbers that work.
 +
 
 +
If the number <math>n</math> has four digits, then we have a total of <math>9 +\binom{9}{2}\left(\binom{4}{1}+\binom{4}{2} +\binom{4}{3}\right) + 9 \cdot \left(\binom{3}{1}+\binom{3}{2} +\binom{3}{3}\right)</math> so in total we get <math>\boxed{927}</math> numbers that work.
 +
 
 +
 
 +
Alternatively, <math>n</math> has four digits can be calculated as follows: When <math>n</math> has one unique digit, there are <math>9</math> possibilities. When <math>n</math> has two unique digits there are two cases. Case 1: two digits are the same with each other and different with the other pair of similar digits. In that case there are <math>\frac{\binom{4}{2}(9^2)}{2}</math> numbers that work. The case had to be divided by <math>2</math> because it counts the cases of distinct digits <math>(x,y)</math> again when <math>(y,x)</math> is picked. Case 2: three digits are the same and one is different. There are <math>4(9^2)</math> numbers that work.
  
 
== See also ==
 
== See also ==
Line 17: Line 32:
  
 
[[Category:Intermediate Combinatorics Problems]]
 
[[Category:Intermediate Combinatorics Problems]]
 +
{{MAA Notice}}

Latest revision as of 00:16, 19 January 2024

Problem

How many positive integers less than 10,000 have at most two different digits?

Solution

First, let's count numbers with only a single digit. We have nine of these for each length, and four lengths, so 36 total numbers.

Now, let's count those with two distinct digits. We handle the cases "0 included" and "0 not included" separately.

There are ${9 \choose 2}$ ways to choose two digits, $A$ and $B$. Given two digits, there are $2^n - 2$ ways to arrange them in an $n$-digit number, for a total of $(2^1 - 2) + (2^2 - 2) + (2^3 -2) + (2^4 - 2) = 22$ such numbers (or we can list them: $AB, BA, AAB, ABA, BAA, ABB, BAB, BBA, AAAB, AABA, ABAA,$ $BAAA, AABB, ABAB, BAAB, ABBA, BABA, BBAA, ABBB, BABB, BBAB, BBBA$). Thus, we have ${9 \choose 2} \cdot 22 = 36\cdot22 = 792$ numbers of this form.

Now, suppose 0 is one of our digits. We have nine choices for the other digit. For each choice, we have $2^{n - 1} - 1$ $n$-digit numbers we can form, for a total of $(2^0 - 1) + (2^1 - 1) + (2^2 - 1) + (2^3 - 1) = 11$ such numbers (or we can list them: $A0, A00, A0A, AA0, A000, AA00, A0A0, A00A, AAA0, AA0A, A0AA$). This gives us $9\cdot 11 = 99$ numbers of this form.

Thus, in total, we have $36 + 792 + 99 = \boxed{927}$ such numbers.

Solution 2

We use casework on the number of digits for this problem.

If the number has a single digit, namely the number $n \in [1,9],$ we can clearly all such $n$ work.

If the number has two digits, or the number $n \in [10,99]$ we can clearly see all such $n$ work.

If the number $n$ has three digits, there are a total of $900$ three digit numbers, and there are $9 \cdot 9 \cdot 8$ numbers that have all distinct digits so there are $900 - 9 \cdot 9 \cdot 8$ total three digit numbers that work.

If the number $n$ has four digits, then we have a total of $9 +\binom{9}{2}\left(\binom{4}{1}+\binom{4}{2} +\binom{4}{3}\right) + 9 \cdot \left(\binom{3}{1}+\binom{3}{2} +\binom{3}{3}\right)$ so in total we get $\boxed{927}$ numbers that work.


Alternatively, $n$ has four digits can be calculated as follows: When $n$ has one unique digit, there are $9$ possibilities. When $n$ has two unique digits there are two cases. Case 1: two digits are the same with each other and different with the other pair of similar digits. In that case there are $\frac{\binom{4}{2}(9^2)}{2}$ numbers that work. The case had to be divided by $2$ because it counts the cases of distinct digits $(x,y)$ again when $(y,x)$ is picked. Case 2: three digits are the same and one is different. There are $4(9^2)$ numbers that work.

See also

2004 AIME II (ProblemsAnswer KeyResources)
Preceded by
Problem 3
Followed by
Problem 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
All AIME Problems and Solutions

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. AMC logo.png