Skip to main content
deleted 1 character in body
Source Link
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)

Jelly,  5  4 bytes

Ḋ²ḋṖ

Try it online!

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)
deleted 1 character in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly,  65  54 bytes

Ṗ‘²ḋṖḊ²ḋṖ

Try it online!Try it online!

Jelly,  6  5 bytes

Ṗ‘²ḋṖ

Try it online!

Jelly,  5  4 bytes

Ḋ²ḋṖ

Try it online!

Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly,  6  5 bytes

Ṗ‘²ḋṖ

Try it online!