Here's a small challenge that I set people on ircnet #perl: minigolf: write a program that, given argument n, prints to stdout the sum of the factors of n followed by a newline, e.g. "program 12" should print "16\n" (because factors 12 = 1 2 3 4 6. 1+2+3+4+6=16) (the number itself is not counted as a factor. the argument will be a positive integer >= 2, < 2**16). testcases: ([2,1],[6,6],[9,4],[12,16],[13,1],[15,9],[28,28],[65535,45921])
(the so called restricted divisor function) This is in fact unexpectedly challenging. a 43 is easy. A 40 is hard. Rick klement won with a 39. But there exists in fact a 37 (at least, who knows what this list can find) ! How well can you do ? (people who saw the solution on ircnet #perl need not apply)
