Define $D(n)$ is sum of digits of $n$
Example $D(357)=3+5+7=15$
Let $x\in \mathbb{N}$ Define $f(x)$ as
$$\begin{split} f(x) &= |\{a\le x\mid D(9a)=9\}| \\ \\&= \sum_{D(9a)=9\\ \quad a\le x}1\end{split}$$
Example let $x=15$ then $f(15)=|\{1,2,3,4,5,6,7,8,9,10,12,13,14,15\}|=14$
Note: $9|D(9n)$ for $n\in\mathbb{N}$
Observation table
$$\begin{split} f(1)&= 1 \\ f(10)&=10 \\ f(10^2)&=55 \\ f(10^3)&=220 \\ f(10^4)&=715 \\ f(10^5)&=2002 \\ f(10^6)&=5005 \end{split}$$
Question can it be shown that $f(10^t)=\binom{9+t}9\quad$?
Also observed
Let $g(x) = |\{a\le x\mid D(3a)=3\}| $ then $g(10^t)= \binom{3+t}3$
Python code
k=1
n1=10
k_array = []
while k <= 10**5:
n2=9*k
rem_array = []
while n2 != 0:
mod = n2%n1
if mod != 0:
rem = mod
n2 = n2 - rem
rem_array.append(round(rem))
n2=n2/n1
else:
n2 = n2/n1
rem_array.append(0)
# print(rem_array[::-1])
if round(sum(rem_array)/9)==1:
k_array.append(k)
print("\n ",len(k_array),'f(',k,')','=1')
#else :
#print("\n ",k,'=not ok')
# print(sum(rem_array)/9)
k = k+1
This question is a particular case from previous post, check here. Above problem may helps to solve extending from of $f$. Please help, thank you.
Last Edit: I erase some part and add new things in question, using comment by Peter Phillips. Also to make the question easier.
Yes. We can write $f(x) = \#\{b\le 9x\colon D(b) = 9\}$, since non-multiples of $9$ cannot have $D(b)=9$. In particular, $f(10^t)$ is the number of integers $b$ with at most $t+1$ digits such that $D(b)=9$ (since integers greater than $9\times10^t$ cannot satisfy that condition).
Every such integer can be constructed by arranging a string with $9$ dots and $t$ lines, treating the lines as digit separators, and letting each digit equal the numnber of dots. For example, the number $3105$ has $D(3105)=9$, and it is represented by the string:
The number of such strings is exactly $\binom{9+t}9$.