freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-316-numbers-in-decimal-expansions.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

1.2 KiB
Raw Blame History

id, title, challengeType, videoUrl, dashedName
id title challengeType videoUrl dashedName
5900f4a81000cf542c50ffbb 问题316十进制扩展中的数字 5 problem-316-numbers-in-decimal-expansions

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

鉴于此,找到

注意:代表发言权功能。

--hints--

euler316()应该返回542934735751917760。

assert.strictEqual(euler316(), 542934735751917760);

--seed--

--seed-contents--

function euler316() {

  return true;
}

euler316();

--solutions--

// solution required