Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-323-bitwise-or-operations-on-random-integers.md
Oliver Eyton-Williams ee1e8abd87 feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

49 lines
949 B
Markdown

---
id: 5900f4b01000cf542c50ffc2
title: 'Problem 323: Bitwise-OR operations on random integers'
challengeType: 5
forumTopicId: 301980
dashedName: problem-323-bitwise-or-operations-on-random-integers
---
# --description--
Let y0, y1, y2,... be a sequence of random unsigned 32 bit integers
(i.e. 0 ≤ yi &lt; 232, every value equally likely).
For the sequence xi the following recursion is given:x0 = 0 and
xi = xi-1| yi-1, for i > 0. ( | is the bitwise-OR operator)
It can be seen that eventually there will be an index N such that xi = 232 -1 (a bit-pattern of all ones) for all i ≥ N.
Find the expected value of N. Give your answer rounded to 10 digits after the decimal point.
# --hints--
`euler323()` should return 6.3551758451.
```js
assert.strictEqual(euler323(), 6.3551758451);
```
# --seed--
## --seed-contents--
```js
function euler323() {
return true;
}
euler323();
```
# --solutions--
```js
// solution required
```