Files
gikf 47fc3c6761 fix(curriculum): clean-up Project Euler 281-300 (#42922)
* fix: clean-up Project Euler 281-300

* fix: missing image extension

* fix: missing power

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

* fix: missing subscript

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2021-07-22 12:38:46 +09:00

1.3 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f48a1000cf542c50ff9c Problem 285: Pythagorean odds 5 301936 problem-285-pythagorean-odds

--description--

Albert chooses a positive integer k, then two real numbers a, b are randomly chosen in the interval [0,1] with uniform distribution.

The square root of the sum {(ka + 1)}^2 + {(kb + 1)}^2 is then computed and rounded to the nearest integer. If the result is equal to k, he scores k points; otherwise he scores nothing.

For example, if k = 6, a = 0.2 and b = 0.85, then {(ka + 1)}^2 + {(kb + 1)}^2 = 42.05. The square root of 42.05 is 6.484... and when rounded to the nearest integer, it becomes 6. This is equal to k, so he scores 6 points.

It can be shown that if he plays 10 turns with k = 1, k = 2, \ldots, k = 10, the expected value of his total score, rounded to five decimal places, is 10.20914.

If he plays {10}^5 turns with k = 1, k = 2, k = 3, \ldots, k = {10}^5, what is the expected value of his total score, rounded to five decimal places?

--hints--

pythagoreanOdds() should return 157055.80999.

assert.strictEqual(pythagoreanOdds(), 157055.80999);

--seed--

--seed-contents--

function pythagoreanOdds() {

  return true;
}

pythagoreanOdds();

--solutions--

// solution required