Project Euler 140 - Modified Fibonnaci golden nuggets
Project Euler 140 - Modified Fibonnaci golden nuggets
Official link: https://projecteuler.net/problem=140
Thought Process
Thought Process
Same as for problem 137
Here comes the main difference between Problem 140 and 137, after generating the first few terms the pattern is very difficult to find so instead we will solve the Pells equation: 5x^2 + 14x + 1 - y^2 = 0
Here is a great tool: Dario Alpern’s Generic Two integer variable equation solver
The tool generates the 2 recursive equations
(1) xn+1 = - 9 xn - 4 yn - 14
(2) yn+1 = - 20 xn - 9 yn - 28
With a bunch of starting values for x and y
From there you can code a simple recursion function much like the Fibonnaci sequence I showed in Problem 2 with all the different solutions
Interactive Code
Interactive Code
Enter a number (yourinput)
Code will output the sum of the first yourinput nuggets