This formula for the number of semi-primes less than or equal to $n$ is from http://mathworld.wolfram.com/Semiprime.html. A semi-prime may be written as $p*q$, where we can assume $p\le q$. The number of semi-primes less than or equal to a maximum $n$ requires checking $\pi(\sqrt{n})$ values of $p$, where $\pi$ is the prime counting function. For each possible $p_k$ there are $\pi(n/p_k)$ values of $q$ such that $p*q\le n$. However, the condition $p\le q$ means that not all these possible $q$ are allowed. The first $k-1$ possible values of $q$ must be dropped. Thus,
$\pi^{(2)}(n)=\sum_{k=1}^{\pi(\sqrt{n})} \left[ \pi(n/p_k)-k+1 \right]$
SemiprimeCount[n_Integer] := Sum[PrimePi[n/Prime[k]]-k+1, {k,1,PrimePi[Sqrt[n]]}]
SetAttributes[SemiprimeCount,Listable]
I make plots using the functionBlockPlot
BlockPlot[v_] := Partition[Flatten[
{1, v[[1]], Table[{i, v[[i - 1]], i, v[[i]]}, {i, 2, Length[v]}]}], 2]
and, for example,
ListLinePlot[BlockPlot[SemiprimeCount[Range[50]]], Frame->True,
PlotStyle -> {Thick, Red}, BaseStyle -> {FontSize->14},
FrameLabel -> {"Number n", "Semiprime Count"},
PlotLabel -> "Number of Semiprimes \[LessEqual] n",
Filling -> Automatic]