Here is an algorithmicx implementation:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{algorithm,algcompatible,amssymb,amsmath}
\renewcommand{\COMMENT}[2][.5\linewidth]{%
\leavevmode\hfill\makebox[#1][l]{//~#2}}
\algnewcommand\algorithmicto{\textbf{to}}
\algnewcommand\RETURN{\State \textbf{return} }
\begin{document}
\begin{algorithm}
\caption{$\text{function}(n : \mathbb{N}_0) : \mathbb{N}_0$}\label{algo1}
\begin{algorithmic}[1]
\REQUIRE $n \in \mathbb{N}_0$
\STATE $\text{result} \leftarrow 0 : \mathbb{N}_0$
\STATE $\text{temp} \leftarrow 1 : \mathbb{N}_0$
\FOR{$i \leftarrow 0$ \algorithmicto{} $n-1$} \COMMENT{$n$ Durchläufe}
\FOR{$j \leftarrow i$ \algorithmicto{} $i$}
\STATE $\text{temp} \leftarrow \text{temp} \cdot 2$ \COMMENT{Multiplikation}
\ENDFOR
\STATE $\text{result} \leftarrow \text{result} + \text{temp}$ \COMMENT{Addition}
\STATE $\text{temp} \leftarrow 1$
\ENDFOR
\RETURN $\text{result}$
\end{algorithmic}
\end{algorithm}
\end{document}
\COMMENT[<len>]{<stuff>} is reformatted to put the comment <stuff> in a box of width <len> (default is .5\linewidth) flush right. You can adjust this to your liking.
A pure algorithmic implementation is somewhat different:
\usepackage{letltxmacro}
\newlength{\commentindent}
\setlength{\commentindent}{.5\textwidth}
\makeatletter
\renewcommand{\algorithmiccomment}[1]{\unskip\hfill\makebox[\commentindent][l]{//~#1}\par}
\LetLtxMacro{\oldalgorithmic}{\algorithmic}
\renewcommand{\algorithmic}[1][0]{%
\oldalgorithmic[#1]%
\renewcommand{\ALC@com}[1]{%
\ifnum\pdfstrcmp{##1}{default}=0\else\algorithmiccomment{##1}\fi}%
}
\makeatother
It uses e-TeX (for the string comparison), but that can be changed. The reason for the difference in implementation is mainly because of the way loops are handled in algorithmic - the comment is inserted as an optional argument to the loop structure. As such, it's difficult to allow another optional argument for the length parameter as above in the algorithmicx implementation. The work-around is to define a length \commentindent that handles this in a similar way the optional argument would handle things.
Here's a full implementation, with the same output:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{algorithm,algorithmic,amssymb,amsmath,letltxmacro}
\newlength{\commentindent}
\setlength{\commentindent}{.5\textwidth}
\makeatletter
\renewcommand{\algorithmiccomment}[1]{\unskip\hfill\makebox[\commentindent][l]{//~#1}\par}
\LetLtxMacro{\oldalgorithmic}{\algorithmic}
\renewcommand{\algorithmic}[1][0]{%
\oldalgorithmic[#1]%
\renewcommand{\ALC@com}[1]{%
\ifnum\pdfstrcmp{##1}{default}=0\else\algorithmiccomment{##1}\fi}%
}
\makeatother
\begin{document}
\begin{algorithm}
\caption{$\text{function}(n : \mathbb{N}_0) : \mathbb{N}_0$}\label{algo1}
\begin{algorithmic}[1]
\REQUIRE $n \in \mathbb{N}_0$
\STATE $\text{result} \leftarrow 0 : \mathbb{N}_0$
\STATE $\text{temp} \leftarrow 1 : \mathbb{N}_0$
\FOR[$n$ Durchläufe]{$i \leftarrow 0$ \TO $n-1$}
\FOR{$j \leftarrow i$ \TO $i$}
\STATE $\text{temp} \leftarrow \text{temp} \cdot 2$ \COMMENT{Multiplikation}
\ENDFOR
\STATE $\text{result} \leftarrow \text{result} + \text{temp}$ \COMMENT{Addition}
\STATE $\text{temp} \leftarrow 1$
\ENDFOR
\RETURN $\text{result}$
\end{algorithmic}
\end{algorithm}
\end{document}
\documentclassto\end{document}) example document that demonstrates the problem and allows people to test their answers.