Guai Lists

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

Sample session

Problem information

Author: InfBesos

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

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