62 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | ||
| id: 5900f3851000cf542c50fe98
 | ||
| challengeType: 5
 | ||
| title: 'Problem 25: 1000-digit Fibonacci number'
 | ||
| videoUrl: ''
 | ||
| localeTitle: 问题25:1000位斐波纳契数
 | ||
| ---
 | ||
| 
 | ||
| ## Description
 | ||
| <section id="description"> Fibonacci序列由递归关系定义: <div style="padding-left: 4em;"> F <sub>n</sub> = F <sub>n-1</sub> + F <sub>n-2</sub> ,其中F <sub>1</sub> = 1且F <sub>2</sub> = 1。 </div>因此,前12个学期将是: <div style="padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;"><div> F <sub>1</sub> = 1 </div><div> F <sub>2</sub> = 1 </div><div> F <sub>3</sub> = 2 </div><div> F <sub>4</sub> = 3 </div><div> F <sub>5</sub> = 5 </div><div> F <sub>6</sub> = 8 </div><div> F <sub>7</sub> = 13 </div><div> F <sub>8</sub> = 21 </div><div> F <sub>9</sub> = 34 </div><div> F <sub>10</sub> = 55 </div><div> F <sub>11</sub> = 89 </div><div> F <sub>12</sub> = 144 </div></div>第12个学期F <sub>12</sub>是第一个包含三位数的术语。 Fibonacci序列中包含<var>n个</var>数字的第一项的索引是多少? </section>
 | ||
| 
 | ||
| ## Instructions
 | ||
| <section id="instructions">
 | ||
| </section>
 | ||
| 
 | ||
| ## Tests
 | ||
| <section id='tests'>
 | ||
| 
 | ||
| ```yml
 | ||
| tests:
 | ||
|   - text: <code>digitFibonacci(5)</code>应该返回21。
 | ||
|     testString: 'assert.strictEqual(digitFibonacci(5), 21, "<code>digitFibonacci(5)</code> should return 21.");'
 | ||
|   - text: <code>digitFibonacci(10)</code>应该返回45。
 | ||
|     testString: 'assert.strictEqual(digitFibonacci(10), 45, "<code>digitFibonacci(10)</code> should return 45.");'
 | ||
|   - text: <code>digitFibonacci(15)</code>应该返回69。
 | ||
|     testString: 'assert.strictEqual(digitFibonacci(15), 69, "<code>digitFibonacci(15)</code> should return 69.");'
 | ||
|   - text: <code>digitFibonacci(20)</code>应该返回93。
 | ||
|     testString: 'assert.strictEqual(digitFibonacci(20), 93, "<code>digitFibonacci(20)</code> should return 93.");'
 | ||
| 
 | ||
| ```
 | ||
| 
 | ||
| </section>
 | ||
| 
 | ||
| ## Challenge Seed
 | ||
| <section id='challengeSeed'>
 | ||
| 
 | ||
| <div id='js-seed'>
 | ||
| 
 | ||
| ```js
 | ||
| function digitFibonacci(n) {
 | ||
|   // Good luck!
 | ||
|   return n;
 | ||
| }
 | ||
| 
 | ||
| digitFibonacci(20);
 | ||
| 
 | ||
| ```
 | ||
| 
 | ||
| </div>
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| </section>
 | ||
| 
 | ||
| ## Solution
 | ||
| <section id='solution'>
 | ||
| 
 | ||
| ```js
 | ||
| // solution required
 | ||
| ```
 | ||
| </section>
 |