cs102 lab4


http://www.maths.nuigalway.ie/~gettrick/teach/cs102/labs/2021labs/l4.html



Please first study the program fibBIN.ipynb which is at http://www.maths.nuigalway.ie/~gettrick/teach/cs102/jupYter/ (This program was covered during lectures. It uses the idea of binary powering of a matrix to calculate the Fibonacci numbers.)
Suppose we define the Fibolucci numbers by
f0=0, f1=1, f2=1, and in general fn+1 = fn + fn-1 + fn-2 for n greater than 1.
So, the sequence goes 0, 1, 1, 2, 4, 7, 13, 24, 44, 81,... Use the idea of Binary Powering covered in lectures to write a python program which can calculate the nth Fibolucci number (the number n should be read in from the user). You must not use recursion. Test your program by calculating
  1. The 73rd Fibolucci number
  2. The 97th Fibolucci number
And submit these results with your program.

© NUI, Galway