TITLE: How many numbers are there such that its number of decimal digits equals to the number of its distinct prime factors?
QUESTION [8 upvotes]: Problem
A positive integer is said to be balanced if the number of its decimal digits equals the number of its distinct prime factors. For instance, $15$ is balanced, while $49$ is not. How many balanced numbers are there?
My thoughts
One digit balanced numbers are the prime ones. So, we have $4$ one digit balanced numbers.
Number of 2 digit balanced numbers = number of 2 digit numbers - number of 2 digit prime numbers - number of 2 digit prime powers = $90-21-10=59$.
We can continue doing this until we find no balanced number. But this gets messier in each step.
Edit: As in the comments, I missed many of the numbers.

Is there some easier way to solve the problem?

REPLY [4 votes]: The total number of these numbers is $7812$.
The number of such $n$ digit numbers $a(n)$ is:
n     a(n)
1     7
2     54
3     267
4     871
5     1783
6     2260
7     1708
8     718
9     138
10    6

where $a(n)=0,n\gt 10$, as mentioned by Calvin Lin.
It is sufficient to examine products of $n$-subsets of primes. That is, examine square-free numbers. Then, all solutions are numbers that are multiples of these products (possibly increment exponents of individual primes to iterate these multiples without adding excess factors) and also have correct number of digits.
I used python. I'm not sure if there is a pure mathematical approach (no computers).
from sympy.ntheory import factorint, sieve

def main():
    B = 10 # number base
    r = 0  # total count
    for n in range(1,12):
        R = set()
        G = set()
        a = 0
        n-= 1
    
        # find products of n-subsets of primes in range.
        h([0 for _ in range(n+1)],n,n,B,G)
    
        # find multiples of products that satisfy property.
        for g in G:
            m = 0
            a = g*m
            while a<B**(n+1):
                m += 1
                a = g*m
                if a>=B**n and a<B**(n+1):
                    if len(factorint(a))==n+1:
                       R.add(a)
        print(n+1, len(R))
        r += len(R)
    print(f"Total: {r}.")

# h = try all combinations of distinct primes that won't overshoot
def h(S,d,n,B,G):
    if d==0:
        while f(S,n,B,G)<B**(n+1):
            S[0] += 1
        S[0]=0
        if len(S)>1:
            S[1]+=1
        return S
    else:
        while f(S,n,B,G)<B**(n+1):
            S = h(S,d-1,n,B,G)
        S[d]=0
        if len(S)>d+1:
            S[d+1]+=1
        return S

# f = evaluate the vector S containing indices of corresponding primes
def f(S,n,B,G):
    e,N=0,1
    for s in S:
        N *= sieve[s+e+1]
        e += s+1
        if N>=B**(n+1):
            break
    if N<B**(n+1):
        G.add(N)
    return N

if __name__ == "__main__":
    main()

This python code is not the fastest or prettiest approach, but simply was quick and easy to think of on the spot. Nonetheless, it gets the job done in less than few seconds.
I've also verified these results with a much slower brute force in WA Mathematica.