# Rewrite $365 \times (15^2+16^2)$ as sum of two squares [closed]

Rewrite $365 \times (15^2+16^2)$ as sum of two squares $x^2+y^2$ where $x$ and $y$ are both positive integers.

## closed as off-topic by Deusovi♦, Marius, JonMark Perry, Gareth McCaughan♦, GamowJun 19 '16 at 12:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is off-topic as it appears to be a mathematics problem, as opposed to a mathematical puzzle. For more info, see "Are math-textbook-style problems on topic?" on meta." – Deusovi, Marius, JonMark Perry, Gareth McCaughan, Gamow
If this question can be reworded to fit the rules in the help center, please edit the question.

• May I know the reasons for negative voting? – Anurag Jain Jun 19 '16 at 5:25
• This isn't really a puzzle. – Deusovi Jun 19 '16 at 6:29

Constraint programming (CP) is a programming paradigm where you do intelligent search (rather than brute force) on a search tree when searching for solutions to a constraint satisfaction problem or optimisation problem. Brute forcing this problem would need around 180 000 nodes, which we can do much better than.

A model for the problem in the modelling language MiniZinc can look like this:

var 0..420: x; % 420 is the sqrt of the sum of two squares
var 0..420: y;

constraint x*x+y*y = 365*(15*15+16*16);
constraint x <= y; % Symmetry breaking: assume x is the smaller
solve :: int_search([x,y], first_fail, indomain_split, complete) satisfy;


The resulting search tree, having only 10 leaves, searching for all solutions, looks like this:

And all solutions $(x,y)$ where $x\leq y$ to the problem are as follows:

$(274, 317), (253, 334), (211, 362), (163, 386), (134, 397), (131, 398), (29, 418), (2, 419)$

We know $(a^2+b^2)(c^2+d^2)=(ac+bd)^2+(ad-bc)^2$

$365=13^2+14^2$

Thus, $(13^2+14^2)(15^2+16^2)=(13 \cdot 15+14 \cdot 16)^2+(13 \cdot 16-14 \cdot 15)^2$

$=419^2+2^2$

$365(15^2+16^2)=365(481)=175565=175561+4=419^2+2^2$

• How did you get this? – Anurag Jain Jun 19 '16 at 5:30
• @Human $1^2$ didn't work, so I tried $2^2$. (A more sophisticated way would be to start from the square root of the number and go down.) – f'' Jun 19 '16 at 5:34