Lucas numbers are similar to Fibonacci numbers. Lucas numbers are also defined as the sum of its two immediate previous terms. But here the first two terms are 2 and 1 where as in Fibonacci numbers the first two terms are 0 and 1 respectively.
Mathematically, Lucas Numbers may be defined as:
The Lucas numbers are in the following integer sequence:
2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123 …………..
Write a function int lucas(int n) n as argument and returns the n'th Lucas number.
Read full article from Lucas Numbers - GeeksforGeeks
No comments:
Post a Comment