2018-09-30 22:01:58 +00:00
---
id: 5900f4521000cf542c50ff64
title: 'Problem 229: Four Representations using Squares'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301872
2021-01-13 02:31:00 +00:00
dashedName: problem-229-four-representations-using-squares
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
Consider the number 3600. It is very special, because
2021-07-15 12:26:34 +00:00
$$\begin{align}
& 3600 = {48}^2 + {36}^2 \\\\
& 3600 = {20}^2 + {2× 40}^2 \\\\
& 3600 = {30}^2 + {3× 30}^2 \\\\
& 3600 = {45}^2 + {7× 15}^2 \\\\
\end{align}$$
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
Similarly, we find that $88201 = {99}^2 + {280}^2 = {287}^2 + 2 × {54}^2 = {283}^2 + 3 × {52}^2 = {197}^2 + 7 × {84}^2$.
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
In 1747, Euler proved which numbers are representable as a sum of two squares. We are interested in the numbers $n$ which admit representations of all of the following four types:
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
$$\begin{align}
& n = {a_1}^2 + {b_1}^2 \\\\
& n = {a_2}^2 + 2{b_2}^2 \\\\
& n = {a_3}^2 + 3{b_3}^2 \\\\
& n = {a_7}^2 + 7{b_7}^2 \\\\
\end{align}$$
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
where the $a_k$ and $b_k$ are positive integers.
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
There are 75373 such numbers that do not exceed ${10}^7$.
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
How many such numbers are there that do not exceed $2 × {10}^9$?
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-15 12:26:34 +00:00
`representationsUsingSquares()` should return `11325263` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-15 12:26:34 +00:00
assert.strictEqual(representationsUsingSquares(), 11325263);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-15 12:26:34 +00:00
function representationsUsingSquares() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-15 12:26:34 +00:00
representationsUsingSquares();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```