* fix: clean-up Project Euler 141-160 * fix: corrections from review Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * fix: use different notation for consistency * Update curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md Co-authored-by: gikf <60067306+gikf@users.noreply.github.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
47 lines
1.4 KiB
Markdown
47 lines
1.4 KiB
Markdown
---
|
|
id: 5900f4071000cf542c50ff19
|
|
title: 'Problem 154: Exploring Pascal''s pyramid'
|
|
challengeType: 5
|
|
forumTopicId: 301785
|
|
dashedName: problem-154-exploring-pascals-pyramid
|
|
---
|
|
|
|
# --description--
|
|
|
|
A triangular pyramid is constructed using spherical balls so that each ball rests on exactly three balls of the next lower level.
|
|
|
|
<img class="img-responsive center-block" alt="triangular pyramid constructed using spherical balls with four levels" src="https://cdn.freecodecamp.org/curriculum/project-euler/exploring-pascals-pyramid.png" style="background-color: white; padding: 10px;">
|
|
|
|
Then, we calculate the number of paths leading from the apex to each position: A path starts at the apex and progresses downwards to any of the three spheres directly below the current position. Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it).
|
|
|
|
The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion ${(x + y + z)}^n$.
|
|
|
|
How many coefficients in the expansion of ${(x + y + z)}^{200000}$ are multiples of ${10}^{12}$?
|
|
|
|
# --hints--
|
|
|
|
`pascalsPyramid()` should return `479742450`.
|
|
|
|
```js
|
|
assert.strictEqual(pascalsPyramid(), 479742450);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
function pascalsPyramid() {
|
|
|
|
return true;
|
|
}
|
|
|
|
pascalsPyramid();
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
// solution required
|
|
```
|