/** This program uses a simple brute-force method to find "amicable numbers", that is, pairs of numbers in which the sum of the proper divisors of each number (including 1 but excluding the number itself) equals the other number. */ n = 1 seen = new set do { n = n + 1 if seen.contains[n] next sum = sum[allFactors[n, true, false, false]] if /*sum != n and */ sum[allFactors[sum, true, false, false]] == n { println["$n, $sum"] seen.put[sum] } } while true