TITLE: Formula for the number of numbers $\le n$ with same prime factors as $n$?
QUESTION [6 upvotes]: Is there a more concise formula for this? I threw this one together,
$\sum_{j=1}^{n}(\lfloor\frac{n^{j}}{j}\rfloor-\lfloor\frac{n^{j}-1}{j}\rfloor)(\lfloor\frac{j^{n}}{n}\rfloor-\lfloor\frac{j^{n}-1}{n}\rfloor)=$ number of numbers $\le n$ with same prime factors as $n$.
I can show this by proving that the term in the left parenthesis is only $1$ or $0$ depending on whether or not $j|n^{j},$ which can only happen if the factors in prime factorization of $j$ are a subset of $n$'s. The function in the parenthesis on the right is $1$ or $0$ depending on whether or not $n|j^{n},$ which only occurs if $j$ is a multiple of $rad(n)$, the product of the distinct prime factors of $n$. So, the sum counts the number of numbers $j\le n$ whose prime factorization is a subset of $n$'s and is a multiple of $rad(n)$. This leaves only those with the same factors. I give this info on the sum because people always ask, but I really just need another version.
I'm looking for a different representation of this function than the one I have created above. I can't find a formula for this anywhere. Anybody got one?
Example of the function is, for $n=24$, the prime factors of $24$ are $2$ and $3$. There are $4$ numbers with these factors $\le n,$ which are $(6,12,18,24),$ so the function at $24=4.$ Sequence is A008479 in oeis, but no formula.

REPLY [3 votes]: (I prefer the notation $\displaystyle \sum_{j=1}^n 1_{j | n^j} 1_{ n | j^n} $, and using that for integers $\lfloor \frac{a}{b}\rfloor-\lfloor \frac{a-1}{b}\rfloor= 1_{b|a}$, and $rad(n) = \prod_{p | n} p$)  
we get $$1_{ a | b^a} = 1_{ rad(a) | b}  = 1_{ rad(a) | rad(b)}$$  thus 
$$1_{j | n^j} 1_{  n | j^n} = 1_{ rad(j) | rad(n)}1_{ rad(n) | rad(j)} = 1_{ rad(j)= rad(n)}$$
and $rad(j)= rad(n),\ j \le n$ iff $j = d \ rad(n)$ with $rad(d) | rad(n)$ i.e. iff $d | n^d$
 hence $$\displaystyle \sum_{j=1}^n 1_{ j | n^j} 1_{  n | j^n}  = \sum_{j=1}^n 1_{ rad(j) = rad(n)} = \sum_{d=1}^{n/rad(n)} 1_{rad(d)|rad(n)} = \sum_{d=1}^{n/rad(n)} 1_{d | n^d}$$
and I'm not sure there is much simpler anymore, since this $\sum_{d=1}^{n/rad(n)} 1_{rad(d)|rad(n)}$ seems to depend on the precise prime factors of $n$, say if $p | n$, it depends on the maximum power of $p$ that is $\le \frac{n}{rad(n)}$, and hence on the other prime factors of $n$