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

54 lines
882 B
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: 5900f36f1000cf542c50fe82
title: 问题3最大素数
challengeType: 5
videoUrl: ''
---
# --description--
13195的主要因子是5、7、13和29。
给定<code>数字<!-- code-->的最大素数是多少?</code>
# --hints--
`largestPrimeFactor(2)`应该返回2。
```js
assert.strictEqual(largestPrimeFactor(2), 2);
```
`largestPrimeFactor(3)`应该返回3。
```js
assert.strictEqual(largestPrimeFactor(3), 3);
```
`largestPrimeFactor(5)`应该返回5。
```js
assert.strictEqual(largestPrimeFactor(5), 5);
```
`largestPrimeFactor(7)`应该返回7。
```js
assert.strictEqual(largestPrimeFactor(7), 7);
```
`largestPrimeFactor(13195)`应该返回29。
```js
assert.strictEqual(largestPrimeFactor(13195), 29);
```
`largestPrimeFactor(600851475143)`应该返回6857。
```js
assert.strictEqual(largestPrimeFactor(600851475143), 6857);
```
# --solutions--