2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4911000cf542c50ffa3
|
|
|
|
title: 'Problem 292: Pythagorean Polygons'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301944
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-292-pythagorean-polygons
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
2021-07-22 03:38:46 +00:00
|
|
|
We shall define a pythagorean polygon to be a convex polygon with the following properties:
|
2020-11-27 18:02:05 +00:00
|
|
|
|
2021-07-22 03:38:46 +00:00
|
|
|
- there are at least three vertices,
|
|
|
|
- no three vertices are aligned,
|
|
|
|
- each vertex has integer coordinates,
|
|
|
|
- each edge has integer length.
|
2020-11-27 18:02:05 +00:00
|
|
|
|
2021-07-22 03:38:46 +00:00
|
|
|
For a given integer $n$, define $P(n)$ as the number of distinct pythagorean polygons for which the perimeter is $≤ n$.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Pythagorean polygons should be considered distinct as long as none is a translation of another.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-22 03:38:46 +00:00
|
|
|
You are given that $P(4) = 1$, $P(30) = 3655$ and $P(60) = 891045$.
|
|
|
|
|
|
|
|
Find $P(120)$.
|
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-22 03:38:46 +00:00
|
|
|
`pythagoreanPolygons()` should return `3600060866`.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
2021-07-22 03:38:46 +00:00
|
|
|
assert.strictEqual(pythagoreanPolygons(), 3600060866);
|
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-22 03:38:46 +00:00
|
|
|
function pythagoreanPolygons() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-22 03:38:46 +00:00
|
|
|
pythagoreanPolygons();
|
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
|
|
|
|
```
|