Ratio limits of fibonacci-like series
Definition
$F_{n}\left(0\right)=0$
$F_{n}\left(1\right)=1$
$F_{n}\left(x\right)=n\cdot F_{n}\left(x-1\right)+F_{n}\left(x-2\right)$
For example:
$F_{1}=\left[0,1,1,2,3,5,8,13,21,34,55,89...\right]$
$F_{2}=\left[0,1,2,5,12,29,70,169,408,985...\right]$
$F_{3}=\left[0,1,3,10,33,109,360,1189,3927...\right]$
Challenge
Given n, find the limit of the ratio between consecutive terms, correct to at least the first 5 decimal places.
Test Cases
1 -> 1.61803...
2 -> 2.41421...
3 -> 3.30277...
4 -> 4.23606...
Scoring
This is code-golf. Shortest answer in each language wins.
[APL (Dyalog Classic)], 7 byte …
3y ago
[JavaScript (Node.js)], 27 22 …
3y ago
Stax, 5 bytes òP^↓Φ Run …
3y ago
3 answers
APL (Dyalog Classic), 7 bytes
⎕+∘÷⍣=1
Well, rak is probably not going to answer this, so I might as well ;p
0 comment threads
JavaScript (Node.js), 27 22 bytes
-5 bytes thanks to Hakerh400
Direct computation
f=n=>(n+(n*n+4)**.5)/2
$$\frac{n+\sqrt{n^2+4}}{2}$$
0 comment threads