Proper divisors: Difference between revisions

m
m (typo)
Line 256:
value end = 20k;
value mostDivisors = (start..end)
// numbermap -> divisors count:to {1->0, 2->1, ... 6->3, etc...}
.map((Integer element) => element->divisors(element).size)
// group based on the number of divisors
Line 263:
.mapItems((Integer key, [<Integer->Integer>+] item) => item*.key)
// find the group with the most divisors
.max(byKey(byIncreasing(Integer->[Integer+] x, Integer->[Integer+] y.magnitude)) => x.key <=> y.key);
print("the number(s) with the most divisors between ``start`` and ``end`` is/are:
Anonymous user