2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f5001000cf542c510012
|
|
|
|
title: 'Problem 404: Crisscross Ellipses'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302072
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-404-crisscross-ellipses
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
$E_a$ is an ellipse with an equation of the form $x^2 + 4y^2 = 4a^2$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
$E_a'$ is the rotated image of $E_a$ by $θ$ degrees counterclockwise around the origin $O(0, 0)$ for $0° < θ < 90°$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
<img class="img-responsive center-block" alt="ellipse E_a and ellipse rotated by θ degrees E_a'" src="https://cdn.freecodecamp.org/curriculum/project-euler/crisscross-ellipses.gif" style="background-color: white; padding: 10px;">
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
$b$ is the distance to the origin of the two intersection points closest to the origin and $c$ is the distance of the two other intersection points.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
We call an ordered triplet ($a$, $b$, $c$) a canonical ellipsoidal triplet if $a$, $b$ and $c$ are positive integers.
|
|
|
|
|
|
|
|
For example, (209, 247, 286) is a canonical ellipsoidal triplet.
|
|
|
|
|
|
|
|
Let $C(N)$ be the number of distinct canonical ellipsoidal triplets ($a$, $b$, $c$) for $a ≤ N$.
|
|
|
|
|
|
|
|
It can be verified that $C({10}^3) = 7$, $C({10}^4) = 106$ and $C({10}^6) = 11\\,845$.
|
|
|
|
|
|
|
|
Find $C({10}^{17})$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
`crisscrossEllipses()` should return `1199215615081353`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-29 19:48:24 +02:00
|
|
|
assert.strictEqual(crisscrossEllipses(), 1199215615081353);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
2021-07-29 19:48:24 +02:00
|
|
|
function crisscrossEllipses() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-29 19:48:24 +02:00
|
|
|
crisscrossEllipses();
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|