Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-27-quadratic-primes.md
Oliver Eyton-Williams ee1e8abd87 feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

61 lines
1.4 KiB
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: 5900f3871000cf542c50fe9a
title: 问题27二次素数
challengeType: 5
videoUrl: ''
dashedName: problem-27-quadratic-primes
---
# --description--
欧拉发现了显着的二次公式:$ n ^ 2 + n + 41 $事实证明,公式将为连续的整数值$ 0 \\ le n \\ le 39 $产生40个素数。但是当$ n = 40时40 ^ 2 + 40 + 41 = 4040 + 1+ 41 $可被41整除当然$ n = 41时41 ^ 2 + 41 + 41 $显然可以被整除41.发现了令人难以置信的公式$ n ^ 2 - 79n + 1601 $,它为连续值$ 0 \\ le n \\ le 79 $产生80个素数。系数-79和1601的乘积是-126479。考虑形式的二次方
$ n ^ 2 + an + b $,其中$ | a | &lt;range $和$ | b | \\ le $ $其中$ | n | $是$ n $的模数/绝对值,例如$ | 11 | = 11 $和$ | -4 | = 4 $
找到系数的乘积,$ a $和$ b $,用于生成连续值$ n $的最大素数数的二次表达式,从$ n = 0 $开始。
# --hints--
`quadraticPrimes(200)`应返回-4925。
```js
assert(quadraticPrimes(200) == -4925);
```
`quadraticPrimes(500)`应返回-18901。
```js
assert(quadraticPrimes(500) == -18901);
```
`quadraticPrimes(800)`应返回-43835。
```js
assert(quadraticPrimes(800) == -43835);
```
`quadraticPrimes(1000)`应返回-59231。
```js
assert(quadraticPrimes(1000) == -59231);
```
# --seed--
## --seed-contents--
```js
function quadraticPrimes(range) {
return range;
}
quadraticPrimes(1000);
```
# --solutions--
```js
// solution required
```