1. Math
  2. Statistics And Probability
  3. using r code only...

Question: using r code only...

Question details

4. The Fibonacci numbers are the sequence of numbers defined by the linear recurrence equation Fn F-1 F-2 where F F2 1 and by convention Fo 0. For example, the first 8 Fibonacci numbers are 1, 1, 2, 3, 5, 8, 13, 21. (a) For a given n, compute the nth Fibonnaci number using a for loop (b) For a given n, compute the nth Fibonnaci number using a while loop Print the 15th Fibonacci number obtained from each of the code written above. Hint: You can create a function taking n as argument. Alternatively, write the code for n-15
Using R code only
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution