2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f5351000cf542c510047
|
|
|
|
title: 'Problem 456: Triangles containing the origin II'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 302130
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-456-triangles-containing-the-origin-ii
|
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
|
|
|
Define:xn = (1248n mod 32323) - 16161yn = (8421n mod 30103) - 15051
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Pn = {(x1, y1), (x2, y2), ..., (xn, yn)}
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
For example, P8 = {(-14913, -6630), (-10161, 5625), (5226, 11896), (8340, -10778), (15852, -5203), (-15165, 11295), (-1427, -14495), (12407, 1060)}.
|
|
|
|
|
|
|
|
Let C(n) be the number of triangles whose vertices are in Pn which contain the origin in the interior.
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Examples: C(8) = 20 C(600) = 8950634 C(40 000) = 2666610948988
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Find C(2 000 000).
|
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
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
`euler456()` should return 333333208685971500.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
assert.strictEqual(euler456(), 333333208685971500);
|
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
|
|
|
|
function euler456() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler456();
|
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|