Solution (source code)

= Solution

For a <finite abelian group> $G$ and its <character group of a finite abelian group> $\widehat G$, the <quantum Fourier transform over a finite abelian group> is
$$
\operatorname{QFT}_G|g\rangle
=\frac1{\sqrt{|G|}}\sum_{\chi\in\widehat G}\chi(g)|\chi\rangle.
$$
Replacing $\chi(g)$ by its complex conjugate gives the equally common inverse-transform convention.