Skip to main content
3 of 4
Add test cases to permalink

Clojure, 58 bytes

(fn[s](-(Math/pow(reduce + s)2)(reduce +(map #(* % %)s))))

Try it online!


Edit: I misunderstood the question

Clojure, 55 bytes

#(-(Math/pow(* %(+ % 1)1/2)2)(*(+ % 1)%(+(* 2 %)1)1/6))

Try it online!