Number theoryDifficulty 6.8National olympiadFind the answer
For any positive integer, if the number of 2's in its digits is greater than the number of 3's in its digits, we call that is a good number. And if the number of 3's in its digits is more than the number of 2's in its digits, we call that is a bad number. For example, there are two 2's and one 3 in the number 2023, so 2023 is a good number. But in the number 123, the number of 2 and 3 are both one, so 123 is neither a good number nor a bad number.
Find the difference of numbers of good numbers and bad numbers among the positive integer not greater than 2023.
A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.
Solution
1. Define the sets and functions: - Let G(m,n)={x∈N∣m≤x≤n;x is a good number} - Let g(m,n)=∣G(m,n)∣ - Let B(m,n)={y∈N∣m≤y≤n;y is a bad number} - Let b(m,n)=∣B(m,n)∣ - We need to find d=g(1,2023)−b(1,2023)
2. Break down the range: - g(1,2023)=g(1,1999)+g(2000,2023) - b(1,2023)=b(1,1999)+b(2000,2023)
3. **Prove g(1,1999)=b(1,1999):** - Let U={1,2,…,1998,1999} - For u∈U, represent u as u=u3⋅103+u2⋅102+u1⋅10+u0 where u3∈{0,1} and u2,u1,u0∈{0,1,…,9} - Define the function T:U→U such that: vk=⎩⎨⎧uk32if uk∈{0,1,4,5,6,7,8,9}if uk=2if uk=3 for k∈{0,1,2,3}
4. **Properties of T:** - T(T(u))=u for all u∈U, hence T is injective. - If u∈G(1,1999), then T(u)∈B(1,1999), implying g(1,1999)≤b(1,1999) - If u∈B(1,1999), then T(u)∈G(1,1999), implying b(1,1999)≤g(1,1999)
5. Conclusion from properties: - From the above properties, we get g(1,1999)=b(1,1999)
6. **Calculate g(2000,2023) and b(2000,2023):** - The set V=[2000,2023]∩N contains 24 elements. - Numbers 2003 and 2013 are neither good nor bad. - Therefore, V∖{2003,2013}⊂G(2000,2023) - Hence, g(2000,2023)=22 and b(2000,2023)=0
7. Final calculation: - d=g(2000,2023)−b(2000,2023)=22−0=22
The final answer is 22
Want a route through all this instead of an archive? The track
puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.
Source: NuminaMath-1.5,
licensed Apache-2.0.
Statement and solution reproduced as published; topic and difficulty added by this site.