2018-09-30 23:01:58 +01:00
---
id: 5900f4ee1000cf542c510000
challengeType: 5
2020-05-21 17:31:25 +02:00
isHidden: false
2018-09-30 23:01:58 +01:00
title: 'Problem 385: Ellipses inside triangles'
2019-08-05 09:17:33 -07:00
forumTopicId: 302049
2018-09-30 23:01:58 +01:00
---
## Description
< section id = 'description' >
2019-07-18 17:32:12 +02:00
2018-09-30 23:01:58 +01:00
For any triangle T in the plane, it can be shown that there is a unique ellipse with largest area that is completely inside T.
For a given n, consider triangles T such that:
2019-07-18 17:32:12 +02:00
2018-10-08 01:01:53 +01:00
- the vertices of T have integer coordinates with absolute value ≤ n, and
2018-09-30 23:01:58 +01:00
- the foci1 of the largest-area ellipse inside T are (√13,0) and (-√13,0).
2019-07-18 17:32:12 +02:00
2018-09-30 23:01:58 +01:00
Let A(n) be the sum of the areas of all such triangles.
For example, if n = 8, there are two such triangles. Their vertices are (-4,-3),(-4,3),(8,0) and (4,3),(4,-3),(-8,0), and the area of each triangle is 36. Thus A(8) = 36 + 36 = 72.
It can be verified that A(10) = 252, A(100) = 34632 and A(1000) = 3529008.
Find A(1 000 000 000).
1The foci (plural of focus) of an ellipse are two points A and B such that for every point P on the boundary of the ellipse, AP + PB is constant.
< / section >
## Instructions
< section id = 'instructions' >
< / section >
## Tests
< section id = 'tests' >
```yml
2018-10-04 14:37:37 +01:00
tests:
- text: < code > euler385()</ code > should return 3776957309612154000.
2019-07-26 19:41:55 -07:00
testString: assert.strictEqual(euler385(), 3776957309612154000);
2018-09-30 23:01:58 +01:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function euler385() {
// Good luck!
return true;
}
euler385();
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
// solution required
```
2019-07-18 08:24:12 -07:00
2018-09-30 23:01:58 +01:00
< / section >