Divisor sum from prime-power factorisation

CJam, 15 bytes * 0.8 = 12

q~.{_@)#(\(/}:*

Try it online. The input order is exponent list first, then list of primes (-3 bytes thanks to @Dennis).

For each prime-exponent pair (p, e) find

(p^(e+1) - 1)/(p - 1)

then find the product of all of these. E.g. for 240 this would be

(1 + 2 + 4 + 8 + 16)(1 + 3)(1 + 5) = 31 * 4 * 6 = 744

Depending on how exponentiation is implemented, this can be better than O(sum of exponents).


APL, 18 13 bytes * 0.8 = 10.4

×/(1-⊣×*)÷1-⊣

This creates a dyadic function train that takes the array of factors on the left and the exponents on the right.

×/             ⍝ Vector product of
  (1-⊣×*)      ⍝ each factor^(exponent+1)-1
         ÷1-⊣  ⍝ divided by factor-1

Try it online. Note that this is the same approach as Sp3000's awesomely clever CJam answer.

Saved 5 bytes thanks to Dennis!


Pyth, 13 bytes * 0.8 = 10.4

*Fms^LhdhedCQ

Demonstration.

This answer works somewhat differently from those above. In order to calculate the sum of the factors of the prime powers of the number, instead of using an arithmetic formula, the factors are explictly constructed and summed.

For instance, on the [prime, exponent] pair [2, 4], we map 2 ^ x over 0, 1, 2, 3, 4, giving [1, 2, 4, 8, 16], which is then summed to 31.

The results are then multiplied together and printed.

If exponentiation is implemented properly, or if there is intermediate result caching, this will be O(sum of exponents).