# Finding integer solutions for x² + y² = 41

• Sep 24th 2012, 04:57 AM
Finding integer solutions for x² + y² = 41
How do you find all possible integer solutions of

\$\displaystyle x^2 + y^2 = 41\$

where x and y are integers.
• Sep 24th 2012, 05:15 AM
emakarov
Re: Finding integer solutions for x² + y² = 41
You can do an exhaustive search. The absolute value of both x and y have to be less than 7.
• Sep 24th 2012, 06:25 AM
Re: Finding integer solutions for x² + y² = 41
Quote:

Originally Posted by emakarov
You can do an exhaustive search. The absolute value of both x and y have to be less than 7.

Care to show me what you mean? I was thinking since x and y are integers they are either even or odd numbers. Therefore x = 2n and y = 2m where m and n are integers. And if x and y are odd we can let x = 2p + 1 and y = 2q + 1 where p and q are integers. However I am not sure who to go about from there.
• Sep 24th 2012, 06:35 AM
emakarov
Re: Finding integer solutions for x² + y² = 41
Quote:

Care to show me what you mean?

From Wikipedia:

Quote:

Brute-force search or exhaustive search, also known as generate and test, is a trivial but very general problem-solving technique that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement.

A brute-force algorithm to find the divisors of a natural number n would enumerate all integers from 1 to the square-root of n, and check whether each of them divides n without remainder. A brute-force approach for the eight queens puzzle would examine all possible arrangements of 8 pieces on the 64-square chessboard, and, for each arrangement, check whether each (queen) piece can attack any other.
That is, test x = 1, x = 2 and so on up to x = 6. For each x, test whether 41 - x^2 is a perfect square.

Quote: