Test IFI

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

a.

Given the Fibonacci sequence with the rule of the sequence a n+2 = a n+1+ a n as follows: 1 1
2 3 5 8 13 21 …
The first index of the sequence starts at 1: a1 = 1, a2 = 1, a3 = 2, a4 = 3,…
Write a program that allows to determine: with a value m, the first index of the Fibonacci
sequence whose value at that element is greater than or equal to m.
Eg:
m = 2: result is 3.
m = 9: result is 7. (because a7 = 13 > 9, a6 = 8 < 9)
b. Given an integer matrix grid m.n in which the elements only take the value 0 or 1. For
example, as shown below:

A perforated mesh is a grid where there exists a 3x3 rectangle whose values are all zero
except its center as shown below:

Write a program that allows you to check whether the matrix grid is punctured or not?

You might also like