Here is what I observed :


Let $8p+1 = 256a^2+(2b-1)^2$ with $a$ and $b$ be a positive integers, $p$ and $8p+1$ both prime numbers.


Then $8p+1$ divides $(2^p+1)/3$ only if you can write $8p+1$ as $256a^2+(2b-1)^2$.


For example :


* $1049 = 256 \cdot 2^2+(2 \cdot 3 - 1)^2$ and $1049 = 131 \cdot 8+1$ so $1049$ divides $(2^{131}+1)/3$
* $12569 = 256 \cdot 7^2+(2 \cdot 3 - 1)^2$ and $12569 = 1571 \cdot 8+1$ so $12569$ divides $(2^{1571}+1)/3$
* $2120057 = 256 \cdot 91^2+(2 \cdot 6 - 1)^2$ and $2120057 = 265007 \cdot 8+1$ so $2120057$ divides $(2^{265007}+1)/3$
* $137 = (8 \cdot 17 + 1)$ but you can't write $137$ as $256a^2+(2b-1)^2$ so $137$ does not divide $(2^{17}+1)/3$


For the moment, I didn't find a counterexample with this condition.


I need help for proving it but I don't know how to start.


I thought about Wagstaff numbers and Sophie Germain primes that say if $p \equiv 1 \pmod{4}$ and $2p+1$ is prime then $2p+1$ divides $(2^p+1)/3$ but for $8p+1$ it doesn't work.


This question looks like the one I asked on [Math stack exchange](https://math.stackexchange.com/q/4507944/932679) (for $2^p-1$ and the divisibility by $8p+1$) but I didn't get an answer for the question.


If you found a counterexample please tell me.



Condition for $8p+1$ divides $(2^p+1)/3$?
This follows easily from the octic reciprocity law for $2$. More precisely, it states that if $q$ is a prime of the form $q=8n+1$ and $n$ is odd, then $q=a^2+256b^2$ for some integers $a,b$ (note that $a$ is necessarily odd) if and only if $2$ is a biquadratic residue but not an octic residue, i.e. there is $x \in \mathbb F\_q$ with $x^4=2$ but no $y\in \mathbb F\_q$ with $y^8=2$.
This condition is equivalent to $2^{2n}\equiv 1\pmod q$ and $2^{n}\not\equiv 1\pmod q$, which is the same as $q\mid \frac{2^n+1}{3}$ since $2^{2n}-1=3(2^n-1)\frac{2^n+1}{3}$. For instance, your observation works for non-prime (but odd) values of $p$.
For the reference on octic reciprocity, see, for example, the first paragraph of [Whiteman AL. The Sixteenth Power Residue Character of 2](https://www.cambridge.org/core/journals/canadian-journal-of-mathematics/article/sixteenth-power-residue-character-of-2/E9DF1AA4086D7764A9A21C9FFAED5A36)


