freeCodeCamp/curriculum/challenges/portuguese/10-coding-interview-prep/project-euler/problem-140-modified-fibona...

1.1 KiB
Raw Blame History

id title challengeType forumTopicId dashedName
5900f3fa1000cf542c50ff0c Problem 140: Modified Fibonacci golden nuggets 5 301769 problem-140-modified-fibonacci-golden-nuggets

--description--

Consider the infinite polynomial series AG(x) = xG1 + x2G2 + x3G3 + ..., where Gk is the kth term of the second order recurrence relation Gk = Gk1 + Gk2, G1 = 1 and G2 = 4; that is, 1, 4, 5, 9, 14, 23, ... .

For this problem we shall be concerned with values of x for which AG(x) is a positive integer.

The corresponding values of x for the first five natural numbers are shown below.

xAG(x) (√51)/41 2/52 (√222)/63 (√1375)/144 1/25

We shall call AG(x) a golden nugget if x is rational, because they become increasingly rarer; for example, the 20th golden nugget is 211345365. Find the sum of the first thirty golden nuggets.

--hints--

euler140() should return 5673835352990.

assert.strictEqual(euler140(), 5673835352990);

--seed--

--seed-contents--

function euler140() {

  return true;
}

euler140();

--solutions--

// solution required