func propdiv (n) { n.divisors.first(-1) } {|i| printf("%2d: %s\n", i, propdiv(i)) } << 1..10 var max = 0 var candidates = [] for i in (1..20_000) { var divs = propdiv(i).len if (divs > max) { candidates = [] max = divs } candidates << i if (divs == max) } say "max = #{max}, candidates = #{candidates}"