freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-3-largest-prime-fac...

69 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: 5900f36f1000cf542c50fe82
challengeType: 5
videoUrl: ''
localeTitle: 问题3最大素数
---
## Description
<section id="description">
13195的主要因子是5、7、13和29。
给定<code>数字</ code>的最大素数是多少?
</section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>largestPrimeFactor(2)</code>应该返回2。
testString: assert.strictEqual(largestPrimeFactor(2), 2);
- text: <code>largestPrimeFactor(3)</code>应该返回3。
testString: assert.strictEqual(largestPrimeFactor(3), 3);
- text: <code>largestPrimeFactor(5)</code>应该返回5。
testString: assert.strictEqual(largestPrimeFactor(5), 5);
- text: <code>largestPrimeFactor(7)</code>应该返回7。
testString: assert.strictEqual(largestPrimeFactor(7), 7);
- text: <code>largestPrimeFactor(13195)</code>应该返回29。
testString: assert.strictEqual(largestPrimeFactor(13195), 29);
- text: <code>largestPrimeFactor(600851475143)</code>应该返回6857。
testString: assert.strictEqual(largestPrimeFactor(600851475143), 6857);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function largestPrimeFactor(number) {
// Good luck!
return true;
}
largestPrimeFactor(13195);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>