freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-404-crisscross-elli...

1.3 KiB

id challengeType title forumTopicId
5900f5001000cf542c510012 5 Problem 404: Crisscross Ellipses 302072

Description

Ea is an ellipse with an equation of the form x2 + 4y2 = 4a2. Ea' is the rotated image of Ea by θ degrees counterclockwise around the origin O(0, 0) for 0° < θ < 90°.

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. 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(103) = 7, C(104) = 106 and C(106) = 11845.

Find C(1017).

Instructions

Tests

tests:
  - text: <code>euler404()</code> should return 1199215615081353.
    testString: assert.strictEqual(euler404(), 1199215615081353);

Challenge Seed

function euler404() {
  // Good luck!
  return true;
}

euler404();

Solution

// solution required