7 kyu

n-Bonacci Ratio

230 of 350beniolenio

Description:

The n-Bonacci Ratio

The Fibonacci sequence is the sequence that starts with 0, 1 that increases by the previous two terms added together each time.
In mathematical terms:
F(0) = 0 F(1) = 1 F(x) = F(x-1) + F(x-2)
As the number of terms approaches infinity, the ratio between the last term and the term before that approaches a constant. This is known as the golden ratio. It is approximately equal to 1.61803.

There is another sequence called the Pell Sequence (or the two-bonacci sequence), which is very similar to the Fibonacci sequence:
P(0) = 0 P(1) = 1 P(x) = 2 * P(x-1) + P(x-2)
The ratio between the last two numbers as the length of the sequence approaches infinity also approaches a constant: approximately 2.4142. This is known as the silver ratio.

Your job is to find the n-bonacci ratio as the number of terms approaches infinity, where the n-bonacci sequence is defined as:
n-bonacci(0) = 0 n-bonacci(1) = 1 n-bonacci(x) = n * n-bonacci(x-1) + n-bonacci(x-2)
This value must be precise to at least 8 decimal places.
Mathematics
Algorithms
Fundamentals

Stats:

CreatedMar 5, 2020
PublishedMar 5, 2020
Warriors Trained1163
Total Skips100
Total Code Submissions959
Total Times Completed350
Python Completions230
JavaScript Completions135
COBOL Completions7
Total Stars12
% of votes with a positive feedback rating81% of 98
Total "Very Satisfied" Votes73
Total "Somewhat Satisfied" Votes13
Total "Not Satisfied" Votes12
Total Rank Assessments19
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • beniolenio Avatar
  • ozichukwu Avatar
  • Pnd72 Avatar
  • akar-0 Avatar
Ad