Skip to main content
deleted 8 characters in body
Source Link
rturnbull
  • 3.9k
  • 16
  • 27

R, 4040 38 bytes

Makes use of the formula in the linked math.SE post. Down to 2 bytes thanks to Giuseppe.

c(n<-scan(),(k=(nk<-(n^3-n)/6)+1,k-1,1-k,-k-1)^3

Try it online!Try it online!

R, 40 bytes

Makes use of the formula in the linked math.SE post.

c(n<-scan(),(k=(n-n^3)/6)+1,k-1,-k,-k)^3

Try it online!

R, 40 38 bytes

Makes use of the formula in the linked math.SE post. Down to 2 bytes thanks to Giuseppe.

c(n<-scan(),k<-(n^3-n)/6,k,1-k,-k-1)^3

Try it online!

Source Link
rturnbull
  • 3.9k
  • 16
  • 27

R, 40 bytes

Makes use of the formula in the linked math.SE post.

c(n<-scan(),(k=(n-n^3)/6)+1,k-1,-k,-k)^3

Try it online!