For every real positive integer \(n\), define \( f(n) \) as the number of \(1 \)'s that appear(s) in the decimal representation of all positive integer numbers from \(1\) to \(n\). For example, \( f(6) =1\) and \( f(16) = 9 \). Prove that \( f(10^n) = n(10^{n-1}) + 1\) for all positive integer \(n\).
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
There is a simple combinatorial argument for this.
Notice that f(n)=k+f(n−1) where k is the number of 1s in n. Now, we have only a single 1 in powers of 10, so f(10n)=f(10n−1)+1. Now, all numbers ≤10n−1 are at most n digit numbers (can be thought of as n digit numbers using non negative digits). Now, we need to count the numbers having 1 in their digits. Fixing 1 at one of the digits places is done in n ways and the other n−1 digit places can be assigned a digit from 0 to 9 in 10 ways for each digit place, hence 10n−1 ways. Notice that there's no problem with excessive counting or missing out on counting a few since if a number has m 1s, it is counted exactly once for fixing 1 at each of the m digit places, thus it getting counted exactly m times as desired. Now then, by the rule of product, we have f(10n−1)=n10n−1 and hence we conclude that,
f(10n)=n⋅10n−1+1
Log in to reply
Can you give a proof for f(n)=k+f(n−1)? I still don't get it..
Log in to reply
If f(n) is the number of 1s in the numbers from 1 to n, then this is equivalent to the number of 1s in the numbers from 1 to n−1 plus the number of 1s in n, right? Denoting by k the number of 1s in n, we can write f(n)=k+f(n−1).
Log in to reply
Log in to reply
Such "fixing" argument tend to be common in counting (enumeration) problems.
Log in to reply
Log in to reply
m 1s, it is getting counting exactly m times, no more no less. This is because we want to count the number of occurrences of 1s for that number, which is m.
That part was to show that if a number hasAnd don't worry, if you have any further problems understanding my solution, feel free to ask. I'll try my best to help you understand. After all, a solution is no good if it can't be completely understood by the reader. ;)
PS: I'm typing from my mobile, so I might be late responding to your queries, sorry for that.
What do you mean, by saying "fixing" ?