Efficiently finding primes of form $m^2 + n^4$

72 Views Asked by At

The problem I am struggling with is coming up with an efficient algorithm of finding all Friedlander-Iwaniec primes (those that can be written as $m^2 + n^4$) less than a given bound $B$.

As of right now, my approach is iterating over all coprime pairs $(m, n)$ such that $m^2 + n^4 < B$ (additionally I make sure that $m$ and $n$ have opposite parity) and checking whether computed number is prime. I thought that was sane because the other approach I had in mind was based on finding Pythagorean primes and then checking whether $b$ in $a^2 + b^2$ is perfect square, but that is not very smart because although the set of Pythagorean primes is dense, the subset of Friedlander-Iwaniec primes is not.

In order for the algorithm to be fast enough I suppose there should be a way of filtering some coprime pairs based on already processed ones, but I could be wrong.

Is the algorithm studied in practice or can someone give me a useful hint for solving the problem?

1

There are 1 best solutions below

0
On BEST ANSWER

A naive approach it to generate all the integers of the form $a^2+b^4$ up to $B$ and to test them for primality. This roughly requires $B^{3/4}\left(\log B\right)^4$ operations, and it can be improved by avoiding the generation of the integers of such a form which are trivially composite. Let $p_1,p_2,p_3,\ldots$ the primes of the form $4k+1$ up to $K\log B$. We may skip the generation of $a^2+b^4$ if $a^2+b^4>p_1$ and $a\pmod{p_1}, b\pmod{p_1}$ are such that $a^2+b^4\equiv 0\pmod{p_1}$. So each prime $p_k$ comes with an attached table of forbidden couples $(a,b)\pmod{p_k}$ (whose pre-computation is fairly simple) and the actually generated integers $a^2+b^4$ have to be tested only for large (meaning $>K\log B$) prime divisors. On the other hand, I would not expect this approach to be a huge improvement over the naive one.