# Center line number for equation in algorithm

I would like to use a equation inside an algorithm. The following pseudo code generates a line number, which is not centered with the equation:

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\State{}
\begin{equation*}
e=mc^2
\end{equation*}
\end{algorithmic}
\end{algorithm}
\end{document}


resulting in:

What I would like to have is something like:

Is there a possibility to center the line number vertically at the hight of the equation? Thanks for your help :)

You can enclose the math environment in a \vcenter which itself has to been between dollars

$\vcenter{....}$


\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\State{} $\vcenter{ \begin{equation*} e=mc^2 \end{equation*} }$
\State{} \vcenter{ \begin{align*} x &= y^2 \\ &= z + t \end{align*} }
\end{algorithmic}
\end{algorithm}
\end{document}


One possibility is

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\State{}$e=mc^2$
\end{algorithmic}
\end{algorithm}
\end{document}


but this does not solve the problem, when wanting more than inline math mode..