Solution (source code)

= Solution

Under $\mathbb Q$,
$$
\log S_T\sim N\left(\log S_0+(r-\tfrac12\sigma^2)T,\sigma^2T\right).
$$
Define
$$
d_+=\frac{\log(S_0/K)+(r+\tfrac12\sigma^2)T}{\sigma\sqrt T},
\qquad
d_-=d_+-\sigma\sqrt T
=\frac{\log(S_0/K)+(r-\tfrac12\sigma^2)T}{\sigma\sqrt T}.
$$
The <standard normal cumulative distribution function> $\Phi$ then gives
$$
\mathbb Q(S_T>K)=\Phi(d_-),
\qquad
\mathbb E_{\mathbb Q}[S_T\mathbf1_{\{S_T>K\}}]=S_0e^{rT}\Phi(d_+).
$$
Substitution into the discounted expected payoff yields the <Black-Scholes formula>
$$
\boxed{V_0=S_0\Phi(d_+)-e^{-rT}K\Phi(d_-)}.
$$