Skip to main content
1 of 3
YCor
  • 63.9k
  • 5
  • 187
  • 286

$\newcommand{\Z}{\mathbf{Z}}\newcommand{\Q}{\mathbf{Q}}\DeclareMathOperator\W{\mathcal{W}}$This is just an extended comment. Write $\zeta_n=\exp(2i\pi/n)$.

For a subset $I$ of $\Z/n\Z$, write $$z_I=z_{n,I}=\sum_{j\in I}\zeta_n^j,$$ and $Z_I=Z_{n,I}=|z_{n,I}|^2$ (we omit $n$ in the notation when there is no ambiguity).

The question is equivalent to classifying those $I$ such that $Z_{n,I}\in\frac14\Z$, and describe the numbers $Z_{n,I}$ thus obtained. Indeed, the alternate sum $Z'_I=\sum_{j\in\Z/n\Z}a_j\zeta_n^j$, where $a_j=1$ for $j\in I$ and $a_j=-1$ for $j\notin I$, is equal to $4Z_I$.

Now, observe that $Z_I=z_I\overline{z_I}$ is an algebraic integer. Thus, $Z_I\in\Q$ is equivalent to $Z_I\in\Z$. This explains why the norm $Z'_I=4Z_I$ in your table (second column) is always a multiple of 4.


Note that $\W(n)$ is stable under complementation, and the function $I\mapsto Z_I$ is also invariant under complementation. This reduces to describing subsets $I\in\W(n)$ with $|I|\le n/2$. Also note that $\W(n)$ is invariant under translation in $\Z/n\Z$. It is also invariant under the action of $(\Z/n\Z)^\times$, because the Galois group of the complex numbers over $\Q$ acts transitively on primitive $n$-roots of unity. Thus, $\W(n)$ is $(\Z/n\Z)\rtimes (\Z/n\Z)^\times$-invariant.

Trivial examples of elements of $\W(n)$ are the empty set (with $Z_\emptyset=0$) and singletons (with $Z_{\{j\}}=1$), and thus their complements as well.

Describing more generally those functions $f:\Z/n\Z\to\Q$ such that $\sum_{j\in\Z/n\Z}f(j)\zeta_n^j\in\Q$ can sound as just "more general" but it is also more natural and might allow to use more tools, e.g., of representation-theoretic flavor.


Now here are some comments on the case when $n=p$. In this case (and only in this case), the "only" relation between the $\zeta_p^j$ is the fact that the sum is zero. That is, the family $(\zeta_p^j)_{0\le j\le p-2}$ is linearly $\Q$-free.

Rewrite the condition $Z_I\in\Z$ as $\sum_{j,k\in I}\zeta_n^{j-k}\in\Z$. Write $q=|I|$. In turn, this can be written as $(Z_I=)q+\sum_{\ell\in\Z/p\Z-\{0\}}W_{I,\ell}\zeta_n^\ell\in\Z$, with $W_{I,\ell}=|\{(j,k)\in I^2:j-k=\ell\}|$. Because of the freeness condition, this precisely means that the cardinal $W_{I,\ell}$ is independent of $\ell\in\Z/p\Z-\{0\}$. If this cardinal is $c$, we obtain that $Z_I=q+c\sum_{\ell\in\Z/p\Z-\{0\}}\zeta_n^\ell=q-c$. For emphasis, let us write:

For $p$ prime, a subset $I$ of $\Z/p\Z$ is in $\W(p)$ if and only if the cardinal of $\{(j,k)\in I^2:j-k=\ell\}$ is independent of $p$.

We also have $\sum_{\ell\in\Z/p\Z-\{0\}}W_{I,\ell}=q(q-1)$. Hence, if $|W_{I,\ell}|=c$ for all nonzero $\ell$, we deduce $(p-1)c=q(q-1)$. This shows that the only cardinals $q$ to consider are those such that $p-1$ divides $q(q-1)$ (or, equivalently, such that $p-1$ divides $q(p-q)$). This is quite restrictive. This equality can be rewritten as $Z_I=q(p-q)/(p-1)$.

One can list those pairs $(p,q)$ with $p$ prime, $0\le q\le p/2$, such that $p-1$ divides $q(q-1)$. Among them, the following families, which can be realized:

(0) For every $p$, the trivial solutions $q\in\{0,1\}$ (empty set and singletons);

(1) The next easy case is $q=(p-1)/2$ (i.e., the largest possible $q$ subject to $q\le p/2$). in which the divisibility condition is equivalent to $p\equiv 3(\bmod 4)$. In this case, this is indeed achieved by a subset $I$, namely, $I$ being the set of nonzero squares modulo $p$. In this case $Z_{p,q}=(p+1)/4$ and $c=c_{p,q}$ equals $(p-3)/4$.

Here are the first few values (the case $p=3$ is degenerate since this is part of Case (0))

$p$ $q$ $Z_{p,q}$ $c_{p,q}$
3 1 1 0
7 3 2 1
11 5 3 2
19 9 5 4
23 11 6 5
31 15 8 7
43 21 2 10
47 23 4 11

(2) Another family (empirically obtained): for each prime $p$ of the form $4k^2+1$ for $k$ odd (hence $p\equiv 5(\bmod 16)$), with $q=(p-1)/4(=k^2)$, achieved by the set $I$ of nonzero fourth powers modulo $p$. In this case $Z_{p,q}=3(p-5)/16+1$.

The set of possible $p$ is infinite, by standard conjectures. Here are the first few values (the case $p=5$ being degenerate, being part of (0)).

$p$ $q$ $Z_{p,q}$ $c_{p,q}$
5 1 1 0
37 9 7 2
101 25 19 6
197 49 37 12
677 169 127 42
2917 729 547 182
4357 1089 817 272
5477 1369 1027 342

(3) Another family (empirically obtained): for each prime $p$ of the form $4k^2+9$ for $k$ odd (hence $p\equiv 13(\bmod 16)$), with $q=(p+3)/4(=k^2+3)$, achieved by the set $I$ of fourth powers modulo $p$ (including zero). In this case $Z_{p,q}=3(p+3)/16$.

The set of possible $p$ is infinite, by standard conjectures. Here are the first few values :

$p$ $q$ $Z_{p,q}$ $c_{p,q}$
13 4 3 1
109 28 21 7
1453 364 273 91
3373 844 633 211
3853 964 723 241
4909 1228 921 307
6733 1684 1263 421

(4) For $p=73$, $q=9$, this is achieved by the set of nonzero 8th powers (here $Z_{73,9}=8$, $c_{73,9}=1$). I don't know if this fits in a natural family.

While testing $I$ to be the set of given powers, including or not zero, this is all I could find. For $k$-th powers with $k\le 8$, I tested for $p\le 6000$. For $k$-powers in general I maybe tested for $p\le 200$.

This is not the whole picture, since OP's list includes other cases for $p=31$, namely with $q=6$ and $q=10$ (and even for $p=31$, $q=15$, it shows that there are possible subsets beyond the set of affine images of the set of nonzero squares). I'd be curious if these subsets, say for $p=31$ and $q\in\{6,10\}$ can be defined in a natural way.

YCor
  • 63.9k
  • 5
  • 187
  • 286