Problem 140 of Project Euler is very much a continuation of the Problem 137, as we can see from the problem description

Consider the infinite polynomial series A_{G}(x) =xG_{1}+x^{2}G_{2}+x^{3}G_{3}+ …, where G_{k}is thekth term of the second order recurrence relation G_{k}= G_{k-1}+ G_{k-2}, G_{1}= 1 and G_{2}= 4; that is, 1, 4, 5, 9, 14, 23, … .

For this problem we shall be concerned with values ofxfor which A_{G}(x) is a positive integer.

The corresponding values ofxfor the first five natural numbers are shown below.

xA_{G}(x)(√5-1)/412/52(√22-2)/63(√137-5)/1441/25

We shall call A_{G}(x) a golden nugget ifxis rational, because they become increasingly rarer; for example, the 20th golden nugget is 211345365.

Find the sum of the first thirty golden nuggets.

In Problem 137 I mentioned in the end that the problem could be solved using a Diophantine equation. This is exactly the way I will go for this problem. Continue reading →