Skip to main content
2 of 2
deleted 27 characters in body
pajonk
  • 18.3k
  • 3
  • 26
  • 74

R, 33 bytes

Or R>=4.1, 26 bytes by replacing the word function with \.

function(p)(rev(n<-seq(p))*n)%*%p

Try it online!

pajonk
  • 18.3k
  • 3
  • 26
  • 74