Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-64-odd-period-square-roots.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

91 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f3ac1000cf542c50febf
title: 问题64奇数期平方根
challengeType: 5
videoUrl: ''
dashedName: problem-64-odd-period-square-roots
---
# --description--
所有平方根都是周期性的,当写为连续分数时,可以写成以下形式:
√N= a0 + 1
a1 + 1
a2 + 1
a3 + ......
例如让我们考虑√23
√23= 4 +√23 - 4 = 4 + 1 = 4 + 1
1√23-4
1 +√23 - 37
如果我们继续,我们将得到以下扩展:
√23= 4 + 1
1 + 1
3 + 1
1 + 1
8 + ......
该过程可归纳如下:
a0 = 4
1√23-4=√23+ 47 = 1 +√23-37a1 = 1
7√23-3= 7√23+ 314 = 3 +√23-32a2= 3
2√23-3= 2√23+ 314 = 1 +√23-47a3 = 1
7√23-4= 7√23+ 47 = 8 +√23-4a4= 8
1√23-4=√23+ 47 = 1 +√23-37a5 = 1
7√23-3= 7√23+ 314 = 3 +√23-32a6= 3
2√23-3= 2√23+ 314 = 1 +√23-47a7 = 1
7√23-4= 7√23+ 47 = 8 +√23-4
可以看出序列是重复的。为简明起见我们使用符号√23= \[4;1,3,1,8]来表示块1,3,1,8无限重复。
无理平方根的前十个连续分数表示为√2= \[1;2],周期=1√3= \[1;1,2],周期=2√5= \[2; 4],期间=1√6= \[2;2,4],期间=2√7= \[2;1,1,1,4],期间=4√8= \[2; 1,4],期间=2√10= \[3;6],期间=1√11= \[3;3,6],期间=2√12= \[3;2,6 ]period =2√13= \[3;1,1,1,1,6]period = 5对于N≤13恰好四个连续分数具有奇数周期。 N≤10000的连续分数有多少个奇数周期
# --hints--
`euler64()`应返回1322。
```js
assert.strictEqual(euler64(), 1322);
```
# --seed--
## --seed-contents--
```js
function oddPeriodSqrts() {
return true;
}
oddPeriodSqrts();
```
# --solutions--
```js
// solution required
```