Modified Fibonacci Golden Nuggets
Consider the modified Fibonacci-like sequence defined by G_1 = 1, G_2 = 4, G_k = G_(k-1) + G_(k-2). The generating function is: A_G(x) = xG_1 + x^2 G_2 + x^3 G_3 +... = (x + 3x^2)/(1 - x - x^2) A "...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Consider the infinite polynomial series $A_G(x) = x G_1 + x^2 G_2 + x^3 G_3 + \cdots$, where $G_k$ is the $k$th 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, \dots$.
For this problem we shall be concerned with values of $x$ for which $A_G(x)$ is a positive integer.
The corresponding values of $x$ for the first five natural numbers are shown below.
| $x$ | $A_G(x)$ |
| $\frac{\sqrt{5} - 1}{4}$ | $1$ |
| $\frac{2}{5}$ | $2$ |
| $\frac{\sqrt{22} - 2}{6}$ | $3$ |
| $\frac{\sqrt{137} - 5}{14}$ | $4$ |
| $\frac{1}{2}$ | $5$ |
We shall call $A_G(x)$ a golden nugget if $x$ is rational, because they become increasingly rarer; for example, the $20$th golden nugget is $211345365$.
Find the sum of the first thirty golden nuggets.
Problem 140: Modified Fibonacci Golden Nuggets
Mathematical Foundation
Theorem 1. Setting yields the quadratic , whose discriminant is .
Proof. From : , hence . The discriminant is:
Theorem 2. The condition (for to be a golden nugget) reduces to the generalized Pell equation , where .
Proof. Multiplying by 5:
Setting gives . For to be a positive integer, we need and (since ).
Lemma 1. The fundamental solutions of (with ) are:
Proof. We search for with , i.e., , so . Testing small values:
- : . No.
- : . No.
- : . Yes.
- : . Yes.
- : . No.
- : . Yes.
- : . Yes.
Further solutions are generated from these by the automorphism of the Pell equation.
Theorem 3. Each fundamental solution generates an infinite family via the recurrence using the fundamental solution of :
All solution chains are generated from fundamental solutions and their negatives .
Proof. If solves and solves , then also solves (by the multiplicativity of the Pell norm). Taking gives the stated recurrence. Starting from negative fundamentals produces additional chains that eventually yield positive with .
Lemma 2. The golden nuggets are obtained by filtering: from each chain, select solutions where and . The resulting .
Proof. Direct from Theorem 2.
Editorial
G(x) = x(1+3x)/(1-x-x^2). Find sum of first 30 golden nuggets. Reduces to generalized Pell equation a^2 - 5*b^2 = 44 where a = 5n + 7. We fundamental solutions and their negatives. We then generate solutions along this chain. Finally, advance: (a, b) -> (9a + 20b, 4a + 9b).
Pseudocode
count = 30
Fundamental solutions and their negatives
Generate solutions along this chain
Advance: (a, b) -> (9a + 20b, 4a + 9b)
Complexity Analysis
- Time: where chains and iterations per chain. Each iteration is arithmetic (with big integers, bits at step ).
- Space: to store and sort the nuggets.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
// Solve a^2 - 5*b^2 = 44
// Fundamental solutions: (7,1), (8,2), (13,5), (17,7)
// Recurrence: (a,b) -> (9a+20b, 4a+9b)
// Need a > 7 and a % 5 == 2, then n = (a-7)/5
vector<pair<long long, long long>> fund = {
{7, 1}, {8, 2}, {13, 5}, {17, 7}
};
set<long long> nuggets;
// Try all sign combinations for fundamental solutions
for (auto [a0, b0] : fund) {
vector<pair<long long, long long>> starts = {
{a0, b0}, {-a0, -b0}, {-a0, b0}, {a0, -b0}
};
for (auto [sa, sb] : starts) {
long long a = sa, b = sb;
for (int iter = 0; iter < 40; iter++) {
if (a > 7 && (a - 7) % 5 == 0) {
long long n = (a - 7) / 5;
if (n > 0) nuggets.insert(n);
}
long long na = 9 * a + 20 * b;
long long nb = 4 * a + 9 * b;
a = na;
b = nb;
}
}
}
// Sum first 30
long long sum = 0;
int count = 0;
for (long long n : nuggets) {
if (count >= 30) break;
sum += n;
count++;
}
cout << sum << endl;
return 0;
}
"""
Problem 140: Modified Fibonacci Golden Nuggets
G(x) = x(1+3x)/(1-x-x^2). Find sum of first 30 golden nuggets.
Reduces to generalized Pell equation a^2 - 5*b^2 = 44 where a = 5n + 7.
"""
def solve():
fund = [(7, 1), (8, 2), (13, 5), (17, 7)]
nuggets = set()
for a0, b0 in fund:
for sa, sb in [(a0, b0), (-a0, -b0), (-a0, b0), (a0, -b0)]:
a, b = sa, sb
for _ in range(40):
if a > 7 and (a - 7) % 5 == 0:
n = (a - 7) // 5
if n > 0:
nuggets.add(n)
a, b = 9 * a + 20 * b, 4 * a + 9 * b
sorted_nuggets = sorted(nuggets)[:30]
return sum(sorted_nuggets)
if __name__ == "__main__":
answer = solve()
assert answer == 5673835352990
print(answer)