0

This question is related with the topic: Solving $x^2 + y^2 = M$ over integers

I have understood the formula used to determine $(x,y)$ such that $x^2+y^2=M$ with $M$ composite. But what if $M$ is a large prime such as $M=1000000241$ do I have to do only bruteforcing? Are there other methods?

EDIT:

I know that $M$ must be a prime of the form $4k+1$ but how to find $(x,y)$?

Thanks

Matteo
  • 6,581

2 Answers2

1

The bad news is that, yes, brute force is [currently] your only real recourse for large primes.

The good news is that primes which are the sum of two squares have a unique representation in that form… so once you find a representation, you’re done.

Kieren MacMillan
  • 7,889
  • 2
  • 28
  • 70
  • And what for a smaller prime $M$? – Matteo Jan 12 '20 at 17:59
  • you can actually sieve out a lot. it's just you can't tell which part is which one must be nonzero mod 3, one must be odd, one must be 1 or 4 mod 5... etc. –  Jan 12 '20 at 18:20
0

$x^2 + y^2 = M$ represents a circle with $(0,0)$ as its center and $\sqrt{M}$ as its radius.

So once you plot this circle on a Cartesian system, then you should be able to find all values of $x$ and $y$ that satisfy your equation.

(I'm assuming you're allowed the use of a graphing calculator.)