freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-316-numbers-in-deci...

72 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f4a81000cf542c50ffbb
challengeType: 5
videoUrl: ''
title: 问题316十进制扩展中的数字
---
## Description
<section id="description">
令p = p1 p2 p3 ...是无限数的随机数字序列,它们以相等的概率从{0,1,2,3,4,5,6,7,8,9}中选择。
可以看出p对应于实数0.p1 p2 p3 ....
还可以看出,从间隔[0,1中选择一个随机实数等效于选择一个从{0,1,2,3,4,5,6,7,8 9}的概率相等。
对于具有d个十进制数字的任何正整数n令k为最小索引以使pkpk + 1... pk + d-1为n的十进制数字顺序相同。
同样令gn为k的期望值 可以证明gn总是有限的有趣的是总是整数。
例如如果n = 535
对于p = 31415926535897 ....我们得到k = 9
对于p = 355287143650049560000490848764084685354 ...我们得到k = 36
等等我们发现g535= 1008。
鉴于此,找到
注意:代表发言权功能。
</section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler316()</code>应该返回542934735751917760。
testString: assert.strictEqual(euler316(), 542934735751917760);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler316() {
// Good luck!
return true;
}
euler316();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>