kth order Fibonacci numbers series [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11开发者_Python百科 years ago.
Improve this questionI am reading an article on Fibonacci numbers at following link
http://xlinux.nist.gov/dads/HTML/kthOrderFibonacci.html
F(k)n = 0 for 0 ≤ n ≤ k-2
i am not getting what about above statement.
For example when k = 3 and n =2, 0 <= 2 < 1 which is not making sense? can any one please elaborate and pls give an example first 10 numbers 3rd order Fibonacci numbers
The statement you quoted indicates that the first k-1
numbers in the sequence are zero.
if f(k,n) is zero for all n such that 0 <= n < k-2, then f(3, n) is zero for all n such that 0 <= n <= 1. So f(3,0) and f(3,1) are both zero.
Second Order:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34...
Third Order:
0, 0, 1, 1, 2, 4, 7, 13, 24, 44...
Fourth Order:
0, 0, 0, 1, 1, 2, 4, 8, 15, 29...
For k=3 and n=2, you are looking at the wrong part of the definition. In your case, n = k-1, so you would you the second part of the definition or, F(k)k-1 = 1
, so when k=3 and n=2, f(k) = 1.
For 3rd order, n=0 to n=10, you would have 0, 0, 1, 1, 2, 4, 7, 13, 24, 44, 81
edit for not being able to add =)
Basically you can't sum the k values preceding n if n < k - 1, simply because there aren't enough numbers. :) as for your example, since n = k - 1 then f(n = 2) = 1.
n f reason
--------------------------------------------------
0 0 by definition (because n <= k - 2 = 1)
1 0 see above
2 1 by definition (because n = k - 1 = 2)
3 1 1 + 0 + 0
4 2 1 + 1 + 0
5 4 2 + 1 + 1
6 7 4 + 2 + 1
7 13 7 + 4 + 2
8 24 14+ 7 + 4
精彩评论