values of length n. Number its positions starting from 1. Position i is special if n is divisible by i.
Return the sum of the squares of the elements sitting at special positions.values=[3, 1, 4, 1, 5, 9] → 107
The length is 6, with divisors 1, 2, 3 and 6. Those places hold 3, 1, 4 and 9: 9 + 1 + 16 + 81 = 107.
values=[2, 8, 6, 7, 5] → 29
The length 5 is prime, so only places 1 and 5 qualify: 4 + 25 = 29.
values=[3, 1, 4, 1, 5, 9]
107
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.