Guai Lists

We say that a list ff is nn-guai if all the elements in ff that are in positions multiples of nn are themselves multiples of nn. For example, f=[0,1,2,3,4,5,10,10,10,10,25,11]f = [0,1,2,3,4,5,10,10,10,10,25,11] is 5-guai, because in positions 0, 5 and 10 (which are multiples of 5) the elements f[0]=0f[0] = 0, f[5]=5f[5] = 5, and f[10]=25f[10] = 25, are also multiples of 5. Instead, f=[0,1,2,3,4,8]f = [0,1,2,3,4,8] 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 ff of non-negative integers and an integer nn greater than zero returns boolean True if ff is nn-guai and False otherwise.

Sample session

Problem information

Author: InfBesos

Generation: 2026-01-25T16:19:05.729Z

© Jutge.org, 2006–2026.
https://jutge.org