This might be more readable without declaring extra variables?

return arithmetic_sum(a, Math.floor((n - 1) / a)) +
    arithmethic_sum(b, Math.floor((n - 1) / b) -
    arithmetic_sum(a * b, Math.floor((n - 1) / (a * b));

Perhaps make (n - 1) a var? "const m = n - 1"?

Also I think var can effectively not be used in harmony javascript and "let" and "cost" can always be used instead.