freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-461-almost-pi.md

1.1 KiB
Raw Blame History

id challengeType videoUrl title
5900f53a1000cf542c51004c 5 问题461几乎是Pi

Description

对于所有非负整数k设fnk= ek / n-1。值得注意的是f2006+ f20075+ f20089+ f200226= 3.141592644529 ...≈π。事实上对于n = 200它是fna+ fnb+ fnc+ fnd形式的π的最佳近似值。设gn= a2 + b2 + c2 + d 2为abcd最小化错误| fna+ fnb+ fnc+ fnd - π| (其中| x |表示x的绝对值。给出g200= 62 + 752 + 892 + 2262 = 64658.求g10000

Instructions

Tests

tests:
  - text: <code>euler461()</code>应该返回159820276。
    testString: assert.strictEqual(euler461(), 159820276);

Challenge Seed

function euler461() {
  // Good luck!
  return true;
}

euler461();

Solution

// solution required

/section>