An open problem posed by G. Maksa and Z. Páles is to find the general solution of the functional equation \(\begin{aligned} \{\Vert f(x)-\beta f(y)\Vert : \beta \in {\mathbb {T}}_n\}=\{\Vert x-\beta y\Vert : \beta \in {\mathbb {T}}_n\} \quad (x,y\in H) \end{aligned}\) where \(f: H \rightarrow K\) is between two complex normed spaces and \({\mathbb {T}}_n:=\{e^{i\frac{2k\pi }{n}}: k=1, \cdots ,n\}\) is the set of the nth roots of unity. With the aid of the celebrated Wigner’s unitary-antiunitary theorem, we show that if \(n\ge 3\) and H and K are complex inner product spaces, then f satisfies the above equation if and only if there exists a phase function \(\sigma : H\rightarrow {\mathbb {T}}_n\) such that \(\sigma \cdot f\) is a linear or anti-linear isometry. Moreover, if the solution f is continuous, then f is a linear or anti-linear isometry.