How many 10-digit number such no digit occurs 4 or more times? (leading 0 not allowed) I'm stuck here. My first approach was to enumerate the sample space: $10^{10}-10^{9}=9\cdot10^{9}$
From here, I just think of how many numbers have 4 or more of the same digit:
(_._._._).10.10.10.10.10.10
^repeated digits counting as one group.

But I think It's a wrong approach, because I will need to worry about duplicates. like (1111222234)
Can someone help? What could be a better approach to this problem?
 A: Suppose we  ask about  $n$-digit numbers  in base  $b$ where  no digit
occurs more  than $k$ times. Observe  that the species of  ordered set
partitions into $q$ non-empty sets containing at most $k$ elements is
$$\mathfrak{S}_{=q}(\mathfrak{P}_{\le k}(\mathcal{Z})).$$
Therefore it has EGF
$$f_{q,k}(z) = \left(\sum_{p=1}^k \frac{z^p}{p!}\right)^q.$$
This implies that the number  $Q_n$ of $n$-digit strings (i.e. leading
zeroes allowed) is given by
$$Q_n = \sum_{q=1}^b {b\choose q} n! [z^n] f_{q,k}(z).$$
We  then obtain  for  $n$-digit  numbers (as  opposed  to strings)  by
symmetry the  value (we subtract  the number of strings  starting with
zero)
$$Q_n - \frac{1}{b} Q_n = \frac{b-1}{b} 
n! [z^n] \sum_{q=1}^b {b\choose q} f_{q,k}(z).$$
Now we have ${b\choose 0} f_{0,k}(z) = 1$ so $q=0$ does not contribute
to the coefficient on $[z^n]$ when $n\ge 1$ and we may write
$$\frac{b-1}{b} n! [z^n] 
\sum_{q=0}^b {b\choose q} f_{q,k}(z)
\\ = \frac{b-1}{b} n! [z^n] 
\sum_{q=0}^b {b\choose q} \left(\sum_{p=1}^k \frac{z^p}{p!}\right)^q
\\ = \frac{b-1}{b} n! [z^n] \left(\sum_{p=0}^k \frac{z^p}{p!}\right)^b.$$
In  particular we  have with  $b=10$ (decimal)  and $n=10$  (ten-digit
numbers) and $k=3$ (no digit occurs four or more times)
$$\bbox[5px,border:2px solid #00A000]{7857440640.}$$
Observe that this last formula correspondes to the species
$$\mathfrak{S}_{=b}(\mathfrak{P}_{0\le\cdot\le k}(\mathcal{Z}))$$
which says that  we have a sequence  of $b$ sets $D_m$  where each set
contains the  positions in  the $n$-digit string  where the  digit $m$
appears. We see  that the derivation then follows  by inspection.  The
initial  derivation  used  a  classification of  the  set  of  strings
according to the set of constituent digits.
The  Maple   code  including   a  total  enumeration   routine  for
verification was as follows.

EN :=
proc(n, b, k)
option remember;
local res, ind, d, dmset, kinst;

    res := 0;

    for ind from b^(n-1) to b^n-1 do
        d := convert(ind, base, b);
        dmset := convert(d, `multiset`);

        kinst := max(seq(p[2], p in dmset));
        if kinst <= k then
            res := res + 1;
        fi;
    od;

    res;
end;


X :=
proc(n, b, k)
    local gf;

    gf := expand(add(z^p/p!, p=0..k)^b);
    n!*(b-1)/b*coeff(gf, z, n);
end;

A: @barakmanos has compiled the list of partitions of $10$ with all parts $\leq3$. There are $14$ such partitions, encoded as $$(x_k,y_k,z_k)\qquad(1\leq k\leq 14)\ ,$$ whereby $(x,y,z)$ denotes a partition of $10$ into $x$ parts of size $3$, $y$ parts of size $2$, and $z$ parts of size $1$, hence $3x+2y+z=10$.
Given such an $(x,y,z)$ we now count the number of strings, where $x$ digits appear $3$ times, $y$ digits appear $2$ times, and $z$ digits appear $1$ time, disregarding the condition that a string should not begin with $0$.
We can choose the involved digits in $${10\choose x}{10-x\choose y}{10-x-y\choose z}$$ ways, and when we have chosen these $x+y+z$ digits we can
arrange them in
$${10!\over 6^x 2^y 1^z}$$
ways. The total number $N_0$ of such strings is then given by
$$\sum_{k=1}^{14} {10\choose x_k}{10-x_k\choose y_k}{10-x_k-y_k\choose z_k}{10!\over 6^{x_k} 2^{y_k}}=8\,730\,489\,600\ .$$
Due to symmetry exactly one tenth of all these strings begin with a $0$. If we reject these strings we obtain the following number of admissible strings:
$$N={9\over10}N_0=7\,857\,440\,640\ .$$
