# Conjecture on twin primes

Let $p$ and $p+2$ be both prime. I conjectured (with my ignorance) that

$$p^{\frac{p+1}{2}}\equiv -1\mod{(p+2)}$$

except for $p=17,41,71,137, 191, 239....$ I verified this on Mathematica. So for which twin primes the modular equivalence above is true?(It seems like for majority of twin prime pairs its true) How to determine that?

• I read the title and thought it would be this or something related. – Zubin Mukerjee Apr 24 '14 at 8:39
• Let's start by figuring out if there are finitely many twin primes or not. :) – Patrick Da Silva Apr 24 '14 at 8:41

For all $a$ coprime to a prime $q$ we have $a^{\frac{q-1}2}$ congruent to either $+1$ or $-1$ modulo $q$ all according to whether $a$ is a quadratic residue modulo $q$ or not.
Applying this $q=p+2$ and $a=p\equiv -2\pmod{p+2}$ we get that $$p^{\frac{p+1}2}\equiv\pm1\pmod{p+2}$$ all according to whether $-2$ is a quadratic residue modulo $p+2$ or not.
It is known that $-1$ is a QR modulo $q$, iff $q\equiv 1\pmod4$, and that $2$ is a QR modulo $q$, iff $q\equiv \pm1\pmod 8$. Thus (multiplicativity of the Legendre symbol) $-2$ is a QR modulo $q$, iff $q$ is congruent to either $1$ or $3$ modulo $8$.
So for a prime $q=p+2$ we have $$p^{\frac{p+1}2}\equiv-1\pmod{p+2}$$ if and only if $p+2$ is congruent to $5$ or $7$ modulo $8$. Whether $p+2$ is a member of a twin prime pair or not is irrelevant.
In your list $$q=p+2\in\{19,43,73,139,193,241,\ldots$$ the residue classes modulo $8$ are $$\{3,3,1,3,1,1,\ldots\}$$ as a way of confirmation. Do check that for twin prime pairs where the larger prime is congruent to $5$ or $7$ modulo $8$ it does hold.