numbers. Pick out the ones that have exactly four divisors (counting 1 and the number itself) and add up all the divisors of all those numbers.
A number that appears several times is counted every time. If no number qualifies, return 0.numbers=[15, 9, 8] → 39
15 has divisors 1, 3, 5, 15: exactly four, summing to 24. 8 has 1, 2, 4, 8: also four, summing to 15. 9 has only three (1, 3, 9) and does not count. The total is 24 + 15 = 39.
numbers=[10, 10, 1] → 36
Each 10 contributes 1 + 2 + 5 + 10 = 18, and repeats count separately: 36. The number 1 has a single divisor.
numbers=[2, 4, 16] → 0
None of them has exactly four divisors: 2 has two, 4 has three, 16 has five.
numbers=[15, 9, 8]
39
Run checks the first 3 tests in your browser. Submit checks all 138 tests on the server, hidden ones included.