/**
 * Finds the common factors of two given numbers.
 *
 * @param n1 The first number.
 * @param n2 The second number.
 * @return A set containing the common factors of n1 and n2.
 */
fun findCommonFactors(n1: Int, n2: Int): Set<Int> {

    val factorsN1 = mutableSetOf<Int>()
    val factorsN2 = mutableSetOf<Int>()

    for (i in 1..n1) {
        if (n1 % i == 0) {
            factorsN1.add(i)
        }
    }

    for (j in 1..n2) {
        if (n2 % j == 0) {
            factorsN2.add(j)
        }
    }

    val commonFactors = factorsN1.intersect(factorsN2)

    return commonFactors
}
/**
 * Finds the common factors of two given numbers.
 *
 * @param n1 The first number.
 * @param n2 The second number.
 * @return A set containing the common factors of n1 and n2.
 */
fun findCommonFactors(n1: Int, n2: Int): Set<Int> {
/**
 * Finds the common factors of two given numbers.
 *
 * @param n1 The first number.
 * @param n2 The second number.
 * @return A set containing the common factors of n1 and n2.
 */
fun findCommonFactors(n1: Int, n2: Int): Set<Int> {

    val factorsN1 = mutableSetOf<Int>()
    val factorsN2 = mutableSetOf<Int>()

    for (i in 1..n1) {
        if (n1 % i == 0) {
            factorsN1.add(i)
        }
    }

    for (j in 1..n2) {
        if (n2 % j == 0) {
            factorsN2.add(j)
        }
    }

    val commonFactors = factorsN1.intersect(factorsN2)

    return commonFactors
}