65 lines
1.5 KiB
Markdown
65 lines
1.5 KiB
Markdown
---
|
|
id: 5900f40f1000cf542c50ff22
|
|
challengeType: 5
|
|
title: 'Problem 163: Cross-hatched triangles'
|
|
forumTopicId: 301797
|
|
---
|
|
|
|
## Description
|
|
<section id='description'>
|
|
Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size 1 triangle in the sketch below.
|
|
|
|
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle.
|
|
It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size n triangle would thus contain n2 size 1 triangle building blocks.
|
|
If we denote T(n) as the number of triangles present in a triangle of size n, then
|
|
T(1) = 16
|
|
T(2) = 104
|
|
Find T(36).
|
|
</section>
|
|
|
|
## Instructions
|
|
<section id='instructions'>
|
|
|
|
</section>
|
|
|
|
## Tests
|
|
<section id='tests'>
|
|
|
|
```yml
|
|
tests:
|
|
- text: <code>euler163()</code> should return 343047.
|
|
testString: assert.strictEqual(euler163(), 343047);
|
|
|
|
```
|
|
|
|
</section>
|
|
|
|
## Challenge Seed
|
|
<section id='challengeSeed'>
|
|
|
|
<div id='js-seed'>
|
|
|
|
```js
|
|
function euler163() {
|
|
// Good luck!
|
|
return true;
|
|
}
|
|
|
|
euler163();
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
## Solution
|
|
<section id='solution'>
|
|
|
|
```js
|
|
// solution required
|
|
```
|
|
|
|
</section>
|