Skip to main content
3 of 3
deleted 1 character in body
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly,  5  4 bytes

Ḋ²ḋṖ

Try it online!

How?

Implements \$\sum_{i=2}^n{(i^2(i-1))}\$...

Ḋ²ḋṖ - Link: non-negative integer, n
Ḋ    - dequeue (implicit range)       [2,3,4,5,...,n]
 ²   - square (vectorises)            [4,9,16,25,...,n*n]
   Ṗ - pop (implicit range)           [1,2,3,4,...,n-1]
  ḋ  - dot product                    4*1+9*2+16*3+25*4+...+n*n*(n-1)
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282