# Primes $p=x^2+27y^2$ and Ramanujan's $x_1^{1/3} + x_2^{1/3} + x_3^{1/3}$

I was trying to generalize,

$$\sqrt{\sum_{k=1}^5\cos\big(\tfrac{2^k\cdot\,2\pi}{31}\big)}+\sqrt{\sum_{k=1}^5\cos\big(\tfrac{2^k\cdot\,6\pi}{31}\big)}+\sqrt{\sum_{k=1}^5\cos\big(\tfrac{2^k\cdot\,10\pi}{31}\big)} = -\sqrt{\tfrac{-11+3\,\sqrt{62}}{2}} \tag1$$

which is a special case of an identity of Ramanujan's. It led me to a family of primes $p=x^2+27y^2$ (A014752). Let $\beta=2\pi/p$ and define,

$$p=x^2+27y^2=6m+1$$

$$x_1=2\sum_{k=1}^{m}\cos\big(2^k\times\beta\big)$$ $$x_2=2\sum_{k=1}^{m}\cos\big(2^k\times3\beta\big)$$ $$x_3=2\sum_{k=1}^{m}\cos\big(2^k\times m\beta\big)$$ and, $$a = -(x_1+x_2+x_3),\quad b=x_1x_2+x_1x_3+x_2x_3,\quad c=-x_1x_2x_3$$

I noticed some $a,b,c$ were just plain integers. In general, they were algebraic integers at most of a degree $n \leq 9$. The complete list for $p<1000$,

$$\begin{array}{|l|l|} \hline n&\quad\quad\quad p\\ \hline 1& 31, 43, 109, 157, 223, 229, 277, 283, 691, 733, 739, 811\\ 2& 433, 457\\ 3& 307, 439, 499, 643, 727, 919, 997\\ 4& 601\\ 6& (\text{for}\; p>1000?)\\ 9& 127, 397\\ \hline \end{array}$$

Questions:

1. All these primes are also $4^m \equiv 1\pmod p$ (A016108). However, what distinguishes the primes $p$ in the first row from the others such that their $a,b,c$ are just plain integers? (It seems $p\equiv 1\pmod{24}$ have $n=2,4$.)
2. Is there a $p$ with $n=6$? (I'm having trouble with $p=1297$.)

P.S. This is related to a MSE post of mine.

• Isn't it the case that for any prime $p$ whatsoever, that $a,b,c$ are algebraic integers, since $x_1,x_2,x_3$ are algebraic integers? – Pace Nielsen Dec 20 '14 at 20:17
• @PaceNielsen: Yes, I didn't phrase it properly. I meant deg $n \leq 9$. I'll edit the post. – Tito Piezas III Dec 20 '14 at 20:18
• P.S. I've tested all primes $< 2000$ and P. Kosinar has tested all $< 6000$. If $a,b,c$ just has deg $n=1$, then I conjecture that a necessary (but not sufficient) condition is that $p=x^2+27y^2$. Perhaps someone can prove (or disprove) it. – Tito Piezas III Dec 20 '14 at 20:43
• Something is wrong with the three displayed equations: all start with $x_1$, and the multipliers of $\beta$ are $1,3,m$ where you presumably want representatives of the multiplicative group mod cubes (in the case that $2$ generates the cubes). – Noam D. Elkies Oct 27 '16 at 2:44
• @NoamD.Elkies: Oops, typo fixed. – Tito Piezas III Oct 27 '16 at 2:52

Let $\zeta = e^{2\pi i/p}$ be a primitive $p$th root of unity. Then $2 \cos (2\pi k/p) = \zeta^k + \zeta^{-k}$. The Galois group of $\mathbb Q(\zeta)$ is isomorphic to $(\mathbb Z/p \mathbb Z)^\times$ and acts transitively on the powers $\zeta^k$ with $1 \le k \le p-1$. What you want is that the Galois action fixes the set $\{x_1, x_2, x_3\}$. Now $x_j = \sum_{k \in A_j} \zeta^k$ where $A_1 = \{\pm 2^j : 0 \le k < m\} \subset \mathbb Z/p \mathbb Z$ (as a multiset) and similarly for $A_2$ and $A_3$. So you want the natural action of $(\mathbb Z/p \mathbb Z)^\times$ on $\mathbb Z/p \mathbb Z$ by multiplication to just permute these three sets. This is only possible when $A_1$ consists of all cubes in $(\mathbb Z/p \mathbb Z)^\times$. In any case, 2 is a cube (since $p = x^2 + 27 y^2$; this is a famous result due to Gauss). However, not every cube is necessarily $\pm$ a power of 2. For example, for $p = 127$, the powers of 2 give you only 7 residue classes, so $A_1$ has 14 distinct elements, but $(p-1)/3 = 42$ is larger.

The precise condition should be that

1. the order of 2 in the group $(\mathbb Z/p \mathbb Z)^\times$ must be either $2m$ or else $m$ and $m$ must be odd (otherwise $2^{m/2} = -1$ and the positive and negative powers of 2 in $A_1$ coincide), and
2. $3$ is not a cubic residue mod $p$ (this is the condition for $A_1$, $A_2$ and $A_3$ to be pairwise disjoint).

Note that this is consistent with your table. This answers Question 1.

To give an answer to Question 2, here is how you can determine the degree $n$ of your algebraic integers $a$, $b$, $c$. You consider the set $\{A_1, A_2, A_3\}$ and count how many images it has under the natural action of $(\mathbb Z/p \mathbb Z)^\times$. This is $n$.

For $p = 1297$, I get $n = 648$, so it is not surprising that you had trouble. (But then, 1297 is not of the form $x^2 + 27y^2$!) And $p = 3889$ has $n = 6$.

• Thanks! Two quick questions. 1) For $a,b,c$ to be plain integers, it is indeed a necessary (but not sufficient) condition that $p=x^2+27y^2$, or is there an exception? 2) What is the degree $n$ for $p=1297$? – Tito Piezas III Dec 20 '14 at 20:54
• The final statement in my answer is not yet entirely correct; I'll edit it soon. – Michael Stoll Dec 20 '14 at 20:59
• The edits are made. -- It is indeed necessary that $p$ has this form. This is equivalent to $p \equiv 1 \bmod 3$ and $2$ is a cube mod $p$. Since $2 \in A_1$, $2$ must be a cube, and for the set of cubes to be one third of everything, $p$ must be 1 mod 3. – Michael Stoll Dec 20 '14 at 21:21
• Sorry about $p=1297$. I mis-typed something. And I verified that $p=3889=3\cdot6^4+1$ does have $n=6$. I figured there had to be a $n=6$. :) – Tito Piezas III Dec 20 '14 at 21:32
• It is not clear to me what your question is. $x_1$, $x_2$, $x_3$ and $a$, $b$, $c$ are defined as they are, and their degree is what it is. In any case, you might want to look up "Gaussian periods", since this is what your $x_1$, $x_2$, $x_3$ are when $n = 1$ (and in general, they are multiples or linear combinations of Gaussian periods). – Michael Stoll Dec 21 '14 at 10:33