How do you find all possible integer solutions of
$\displaystyle x^2 + y^2 = 41$
where x and y are integers.
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.
From Wikipedia:
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.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.
The numbers x and y cannot be both even or both odd because otherwise their squares are also both even or both odd and therefore the sum of squares is even.