We say that a list is -guai if all the elements in that are in positions multiples of are themselves multiples of . For example, is 5-guai, because in positions 0, 5 and 10 (which are multiples of 5) the elements , , and , are also multiples of 5. Instead, is not 5-guai because in position 5 which is multiple of 5 there is an 8 that is not multiple of 5.
Implement the function @is_n_guai (f, n)@ that given a list
of non-negative integers and an integer
greater than zero returns boolean True if
is
-guai
and False otherwise.
>>> is_n_guai([0,1,2,3,4,5,10,10,10,10,25,11],5) True >>> is_n_guai([0,1,2,3,4,8],5) False >>> is_n_guai([2,2,4,8,10,12],2) True