cs102 lab8


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



Please first study the program fibBIN.py which is at http://www.maths.nuigalway.ie/~gettrick/teach/cs102/progs/ (This program was handed out and 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 72nd Fibolucci number
  2. The 117th Fibolucci number
And submit these results with your program.

© NUI, Galway