2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f47e1000cf542c50ff90
|
|
|
|
title: 'Problem 273: Sum of Squares'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 301923
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-273-sum-of-squares
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
Consider equations of the form: $a^2 + b^2 = N$, $0 ≤ a ≤ b$, $a$, $b$ and $N$ integer.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
For $N = 65$ there are two solutions:
|
|
|
|
|
|
|
|
$a = 1, b = 8$ and $a = 4, b = 7$.
|
|
|
|
|
|
|
|
We call $S(N)$ the sum of the values of $a$ of all solutions of $a^2 + b^2 = N$, $0 ≤ a ≤ b$, $a$, $b$ and $N$ integer.
|
|
|
|
|
|
|
|
Thus $S(65) = 1 + 4 = 5$.
|
|
|
|
|
|
|
|
Find $\sum S(N)$, for all squarefree $N$ only divisible by primes of the form $4k + 1$ with $4k + 1 < 150$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
`sumOfSquares()` should return `2032447591196869000`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-24 09:09:54 +02:00
|
|
|
assert.strictEqual(sumOfSquares(), 2032447591196869000);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
2021-07-24 09:09:54 +02:00
|
|
|
function sumOfSquares() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-24 09:09:54 +02:00
|
|
|
sumOfSquares();
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|