I noticed something interesting with Mersenne primes numbers: You can write it with the form $27x^2+4y^2$ except for 3 and 7 but it seems to work with all other Mersenne primes numbers and their associated perfect numbers.
Another something interesting: it doesn't works for composite Mersenne Numbers like 2047 or 8388607.
Is there a way to explain that? I am unsure of how to start and am hence looking for some tips on how to start.
A Mersenne prime is one of the form $m = 2^p - 1$, looking mod $3$ we see that $$m \equiv (-1)^p - 1 \equiv 1 \pmod 3$$ as soon as $p$ is odd. Thus all Mersenne primes (except 3) are congruent to 1 mod 3.
Now primes congruent to 1 mod 3 are precisely those of the form $$x^2 + 3y^2.$$ But moreover cubic reciprocity gives that (https://www.math.uni-hamburg.de/home/charlton/teaching/primes_17/primes.pdf 9.3): primes of the form $$x^2 + 27y^2$$ are those which are 1 mod 3, and for which 2 is a cubic residue mod the prime. So we have to show that $2 \equiv t^3 \pmod m$. But we have $$0 \equiv 2^p - 1 \pmod m$$ so $$2^p \equiv 1 \pmod m$$ and $2$ has order coprime to $3$ as $p=3$ is excluded, hence is a third power (thanks to Erick Wong for this nicer way of saying this :)). (Alternatively we can argue that: $$2^{p+1} \equiv 2 \pmod m$$ if $p+ 1$ is divisible by 3 then we are done as 2 is the cube of $2^{(p+1)/3}$. Otherwise $p \equiv 1 \pmod 3$ as the case of $p = 3$ is the excluded case, in this case $$(2^p)^2 \equiv 1^2 \equiv 1 \pmod m$$ so $$ 2^{2p + 1} \equiv 2 \pmod m$$ and now $2p + 1$ is divisible by 3.)
So 2 is always a cubic residue modulo a Mersenne prime and $m$ is of the form $$x^2 + 27y^2.$$
We just have to show in this expression that $x$ is even.
Lets look mod 4: A Mersenne prime is always $-1 \pmod 4$ hence we have $$x^2-y^2 \equiv -1 \pmod 4$$ The only squares mod 4 are $0$ and $1$ so we must have $x^2 \equiv 0 \pmod 4$ and $y^2 \equiv 1 \pmod 4$, hence $x$ is even and $y$ is odd.
So now we have that $$m = 4x^2 + 27y^2$$ for a different choice of $x$ (half of the original $x$).