2022-01-20 19:30:18 +00:00
|
|
|
---
|
|
|
|
id: 5900f47e1000cf542c50ff90
|
2022-01-22 15:08:20 +00:00
|
|
|
title: '問題 273: 平方数の和'
|
2022-01-20 19:30:18 +00:00
|
|
|
challengeType: 5
|
|
|
|
forumTopicId: 301923
|
|
|
|
dashedName: problem-273-sum-of-squares
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
式 $a^2 + b^2 = N$, $0 ≤ a ≤ b$ ($a$, $b$, $N$ は整数) について考えます。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
$N = 65$ のとき、解は 2 つあります。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
$a = 1, b = 8$ と、$a = 4, b = 7$ です。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
$a^2 + b^2 = N$, $0 ≤ a ≤ b$ ($a$, $b$, $N$ は整数) のすべての解の $a$ 値の和を $S(N)$ とします。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
したがって、$S(65) = 1 + 4 = 5$ です。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
$4k + 1 < 150$ のとき、$4k + 1$ で表される素数でのみ割り切れるすべての無平方数 $N$ について $\sum S(N)$ を求めなさい。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2022-01-22 15:08:20 +00:00
|
|
|
`sumOfSquares()` は `2032447591196869000` を返す必要があります。
|
2022-01-20 19:30:18 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert.strictEqual(sumOfSquares(), 2032447591196869000);
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
|
|
|
function sumOfSquares() {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
sumOfSquares();
|
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|