freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-37-truncatable-prim...

62 lines
1.6 KiB
Markdown
Raw Normal View History

---
id: 5900f3911000cf542c50fea4
challengeType: 5
title: 'Problem 37: Truncatable primes'
videoUrl: ''
localeTitle: 问题37可截断的素数
---
## Description
<section id="description"> 3797号有一个有趣的财产。作为素数本身可以从左到右连续删除数字并在每个阶段保持素数3797,797,97和7.同样我们可以从右到左工作3797,379,37和3。找到从左到右和从右到左都可截断的唯一n8 &lt;= n &lt;= 11个素数之和。注意2,3,5和7不被认为是可截断的素数。 </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>truncatablePrimes(8)</code>应该返回1986年。
testString: 'assert(truncatablePrimes(8) == 1986, "<code>truncatablePrimes(8)</code> should return 1986.");'
- text: <code>truncatablePrimes(9)</code>应该返回5123。
testString: 'assert(truncatablePrimes(9) == 5123, "<code>truncatablePrimes(9)</code> should return 5123.");'
- text: <code>truncatablePrimes(10)</code>应该返回8920。
testString: 'assert(truncatablePrimes(10) == 8920, "<code>truncatablePrimes(10)</code> should return 8920.");'
- text: <code>truncatablePrimes(11)</code>应该返回748317。
testString: 'assert(truncatablePrimes(11) == 748317, "<code>truncatablePrimes(11)</code> should return 748317.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function truncatablePrimes(n) {
// Good luck!
return n;
}
truncatablePrimes(11);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>