So i need to solve a problem that finds the n-th number that verifies the following: it is the sum of two consecutive primes and it gives an integer square root. My problem is that the sieve of eratosthenes uses too much memory and the naive checking for a prime is too slow. Any way to solve this fast and without aditional memory? I tried using fermat's theorem but it turned out to be slower.
Thanks in advance.