/** This is a solver for Rosetta Code puzzle: "Abundant, deficient and perfect number classifications" https://rosettacode.org/wiki/Abundant,_deficient_and_perfect_number_classifications */ d = new dict for n = 1 to 20000 { s = sum[allFactors[n, true, false, true], 0] rel = s <=> n d.increment[rel, 1] } println["Deficient: " + d@(-1)] println["Perfect: " + d@0] println["Abundant: " + d@1]