2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5900f39e1000cf542c50feb1
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
2020-10-01 17:54:21 +02:00
|
|
|
|
title: 问题50:连续的总和
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id="description">素数41可以写成六个连续素数的总和:41 = 2 + 3 + 5 + 7 + 11 + 13这是连续素数的最长和,它加到低于一百的素数。连续素数低于1000的连续素数加上一个素数,包含21个项,等于953.哪个素数低于一百万,可以写成最连续素数的总和? </section>
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
|
|
|
|
- text: <code>consecutivePrimeSum(1000)</code>应该返回953。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.strictEqual(consecutivePrimeSum(1000), 953);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: <code>consecutivePrimeSum(1000000)</code>应该返回997651。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert.strictEqual(consecutivePrimeSum(1000000), 997651);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function consecutivePrimeSum(limit) {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
consecutivePrimeSum(1000000);
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
|
|
|
|
/section>
|