It seems the font used in the image is Adobe Times/URW Nimbus as provided by the txfonts
package (or some very similar variant of it):
\documentclass{article}
\usepackage{txfonts}
\begin{document}
\[ \hat\thetaup_{ijk} = \hat P(X_i=x_{ij}\mid Y=y_k)
= \frac{\#D\{X_i=x_{ij} \wedge Y=y_k\}}{\#D\{Y=y_k\}} \]
\end{document}

Original answer
The font used in your image is not the default Computer Modern font. You could use \text{\ttfamily\#}
, which is closer to the symbol in the image, but still not the same:
\documentclass{article}
\usepackage{amsmath}
\newcommand\tthash{\text{\ttfamily\#}}
\begin{document}
$\#D$ vs. $\tthash D$
\end{document}

Wikipedia also just lists the standard \#
as a symbol for cardinality.
For the exact same output, you need to find the font that provides this special hash character glyph.