freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-323-bitwise-or-oper...

1.1 KiB
Raw Blame History

id challengeType videoUrl localeTitle
5900f4b01000cf542c50ffc2 5 问题323对随机整数进行按位或运算

Description

令y0y1y2...是随机无符号32位整数的序列 即0≤yi <232每个值的可能性均等。 对于序列xi给出以下递归x0 = 0且 xi = xi-1 | yi-1对于i>0。|是按位或运算符) 可以看出对于所有i≥N最终将存在一个索引N使得xi = 232 -1所有比特的位模式

找到N的期望值。 将答案四舍五入到小数点后10位。

Instructions

Tests

tests:
  - text: <code>euler323()</code>应该返回6.3551758451。
    testString: assert.strictEqual(euler323(), 6.3551758451);

Challenge Seed

function euler323() {
  // Good luck!
  return true;
}

euler323();

Solution

// solution required

/section>