fix(curriculum): clean-up Project Euler 321-340 (#42988)

* fix: clean-up Project Euler 321-340

* fix: typo

* 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>

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-29 20:59:06 +02:00
committed by GitHub
parent a9c11f7fe2
commit 1af6e7aa5a
20 changed files with 264 additions and 186 deletions

View File

@ -12,20 +12,26 @@ Susan has a prime frog.
Her frog is jumping around over 500 squares numbered 1 to 500.
He can only jump one square to the left or to the right, with equal probability, and he cannot jump outside the range \[1;500].(if it lands at either end, it automatically jumps to the only available square on the next move.)
He can only jump one square to the left or to the right, with equal probability, and he cannot jump outside the range [1;500]. (if it lands at either end, it automatically jumps to the only available square on the next move.)
When he is on a square with a prime number on it, he croaks 'P' (PRIME) with probability 2/3 or 'N' (NOT PRIME) with probability 1/3 just before jumping to the next square. When he is on a square with a number on it that is not a prime he croaks 'P' with probability 1/3 or 'N' with probability 2/3 just before jumping to the next square.
When he is on a square with a prime number on it, he croaks 'P' (PRIME) with probability $\frac{2}{3}$ or 'N' (NOT PRIME) with probability $\frac{1}{3}$ just before jumping to the next square. When he is on a square with a number on it that is not a prime he croaks 'P' with probability $\frac{1}{3}$ or 'N' with probability $\frac{2}{3}$ just before jumping to the next square.
Given that the frog's starting position is random with the same probability for every square, and given that she listens to his first 15 croaks, what is the probability that she hears the sequence PPPPNNPPPNPPNPN?
Give your answer as a fraction p/q in reduced form.
Give your answer as a string as a fraction `p/q` in reduced form.
# --hints--
`euler329()` should return 199740353 / 29386561536000.
`primeFrog()` should return a string.
```js
assert.strictEqual(euler329(), 199740353 / 29386561536000);
assert(typeof primeFrog() === 'string');
```
`primeFrog()` should return the string `199740353/29386561536000`.
```js
assert.strictEqual(primeFrog(), '199740353/29386561536000');
```
# --seed--
@ -33,12 +39,12 @@ assert.strictEqual(euler329(), 199740353 / 29386561536000);
## --seed-contents--
```js
function euler329() {
function primeFrog() {
return true;
}
euler329();
primeFrog();
```
# --solutions--