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:
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.
In mathematical terms:
F(0) = 0 | F(1) = 1 | F(x) = F(x-1) + F(x-2) |
There is another sequence called the Pell Sequence (or the two-bonacci sequence), which is very similar to the Fibonacci sequence:
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.
P(0) = 0 | P(1) = 1 | P(x) = 2 * P(x-1) + P(x-2) |
Your job is to find the n-bonacci ratio as the number of terms approaches infinity, where the n-bonacci sequence is defined as:
This value must be precise to at least 8 decimal places.
n-bonacci(0) = 0 | n-bonacci(1) = 1 | n-bonacci(x) = n * n-bonacci(x-1) + n-bonacci(x-2) |
Mathematics
Algorithms
Fundamentals
Similar Kata:
Stats:
Created | Mar 5, 2020 |
Published | Mar 5, 2020 |
Warriors Trained | 1163 |
Total Skips | 100 |
Total Code Submissions | 959 |
Total Times Completed | 350 |
Python Completions | 230 |
JavaScript Completions | 135 |
COBOL Completions | 7 |
Total Stars | 12 |
% of votes with a positive feedback rating | 81% of 98 |
Total "Very Satisfied" Votes | 73 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 12 |
Total Rank Assessments | 19 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |