960

Gaussian Prime Integer Problem

Theory:

First we should know that the multiple of two lengths is the length of the original one. For example, (4,3) has a length of 5, so if we can break (4,3) down into A & B, length(A) * length(B) is also 5.
Next we’ll iterate through all possible combinations (lengths.) We’ll try length up to sqrt(5) in the above example because we can always find a factor whose length is less than or equal to that.
Last, just iterate through all combinations lead to that length and see if it works. To check that, you may just divide it. The code is the final formula for it.

 

Leave a Reply

Your email address will not be published. Required fields are marked *