/**
 * This function finds the intersection of two lists of numbers using modulus operation and enumerate method.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A list containing the common numbers between the two input lists.
 */
fun intersectionModulusEnumerate(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    // Initialize an empty list to store the common numbers
    val commonNumbers = mutableListOf<Int>()

    // Iterate over the first list using forEachIndexed to access both index and value
    numbers1.forEachIndexed { i, num1 ->
        // Iterate over the second list using forEachIndexed to access both index and value
        numbers2.forEachIndexed { j, num2 ->
            // Check if the remainder of dividing num1 by num2 is 0
            if (num1 % num2 == 0) {
                // Check if the common number is not already present in the commonNumbers list
                if (num1 !in commonNumbers) {
                    // If so, add the common number to the commonNumbers list
                    commonNumbers.add(num1)
                }
            }
        }
    }

    return commonNumbers
}
/**
 * This function finds the intersection of two lists of numbers using modulus operation and enumerate method.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A list containing the common numbers between the two input lists.
 */
fun intersectionModulusEnumerate(numbers1: List<Int>, numbers2: List<Int>): List<Int> {
/**
 * This function finds the intersection of two lists of numbers using modulus operation and enumerate method.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A list containing the common numbers between the two input lists.
 */
fun intersectionModulusEnumerate(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    // Initialize an empty list to store the common numbers
    val commonNumbers = mutableListOf<Int>()

    // Iterate over the first list using forEachIndexed to access both index and value
    numbers1.forEachIndexed { i, num1 ->
        // Iterate over the second list using forEachIndexed to access both index and value
        numbers2.forEachIndexed { j, num2 ->
            // Check if the remainder of dividing num1 by num2 is 0
            if (num1 % num2 == 0) {
                // Check if the common number is not already present in the commonNumbers list
                if (num1 !in commonNumbers) {
                    // If so, add the common number to the commonNumbers list
                    commonNumbers.add(num1)
                }
            }
        }
    }

    return commonNumbers
}