/**
 * Given two positive integers, find their common factors.
 *
 * @param a first positive integer
 * @param b second positive integer
 * @return list of common factors between the two positive integers
 */
fun findCommonFactors(a: Int, b: Int): List<Int> {

    val commonFactors = mutableListOf<Int>()

    // Find smaller number between a and b
    val x = if (a < b) a else b

    // Iterate from 1 to x
    for (i in 1..x) {
        // Check if i is a factor of both a and b
        if (a % i == 0 && b % i == 0) {
            commonFactors.add(i)
        }
    }

    return commonFactors
}
/**
 * Given two positive integers, find their common factors.
 *
 * @param a first positive integer
 * @param b second positive integer
 * @return list of common factors between the two positive integers
 */
fun findCommonFactors(a: Int, b: Int): List<Int> {
/**
 * Given two positive integers, find their common factors.
 *
 * @param a first positive integer
 * @param b second positive integer
 * @return list of common factors between the two positive integers
 */
fun findCommonFactors(a: Int, b: Int): List<Int> {

    val commonFactors = mutableListOf<Int>()

    // Find smaller number between a and b
    val x = if (a < b) a else b

    // Iterate from 1 to x
    for (i in 1..x) {
        // Check if i is a factor of both a and b
        if (a % i == 0 && b % i == 0) {
            commonFactors.add(i)
        }
    }

    return commonFactors
}