Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-456-triangles-containing-the-origin-ii.md
gikf a2b2ef3f75 fix(curriculum): clean-up Project Euler 441-460 (#43068)
* fix: clean-up Project Euler 441-460

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2021-07-30 08:20:31 -07:00

1.2 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f5351000cf542c510047 Problem 456: Triangles containing the origin II 5 302130 problem-456-triangles-containing-the-origin-ii

--description--

Define:

$$\begin{align} & x_n = ({1248}^n\bmod 32323) - 16161 \\ & y_n = ({8421}^n\bmod 30103) - 15051 \\ & P_n = \{(x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n)\} \end{align}$$

For example,

P_8 = \\{(-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 P_n which contain the origin in the interior.

Examples:

$$\begin{align} & C(8) = 20 \\ & C(600) = 8\,950\,634 \\ & C(40\,000) = 2\,666\,610\,948\,988 \end{align}$$

Find C(2\\,000\\,000).

--hints--

trianglesContainingOriginTwo() should return 333333208685971500.

assert.strictEqual(trianglesContainingOriginTwo(), 333333208685971500);

--seed--

--seed-contents--

function trianglesContainingOriginTwo() {

  return true;
}

trianglesContainingOriginTwo();

--solutions--

// solution required