Primitive sum in latex

math-operators

How to type a primitive sum (a summation sign with "*" sign at the top right corner) inside the equation?

enter image description here

Best Answer

This can be done with the \sideset command

enter image description here

\documentclass{article}

\usepackage{mathtools}

\newcommand{\psum}{\sideset{}{^*}\sum}

\begin{document}

\[
\sum_{q\le Q}\frac{q}{\varphi(q)}\psum_{\chi(\mathrm{mod}\ q)}
\]

\end{document}

The empty braces in \sideset are needed because \sideset allows for sub- and superscripts on the left side of the operator also.