[Question]
  [
Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example,
```
-10 == -64 - 64 + 64 + 27 + 27
```
so for input `-10` you could output `[-64, -64, 64, 27, 27]`, though other solutions are possible. Note that you should output the cubes, not the numbers being cubed.
A solution [always exists](https://math.stackexchange.com/q/207366/24654) -- you might enjoy puzzling this out for yourself. It's further conjectured that four cubes suffice.
  
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 18 bytes
```
∧5~lLȧᵐ≥₁∧L^₃ᵐ.+?∧
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//1HHctO6HJ8Tyx9unfCoc@mjpkagiE/co6ZmoICetj2Q9/9/vInR/ygA "Brachylog – Try It Online")
### Explanation
We basically describe the problem, with the additional constraint that we want the output list to be non-increasing in terms of magnitudes: this forces Brachylog to properly backtrack over all possible combinations of 5 values, instead of infinitely backtracking over the value of the last element of the list.
```
∧                ∧    (disable some implicit stuff)
 5~lL                 L is a list of length 5
    Lȧᵐ≥₁             L must be a non-increasing list in terms of magnitude
         ∧
          L^₃ᵐ.       The output is L with each element cubed
              .+?     The sum of the output is the input
```
### Finding different solutions
By appending a `≜`, it's possible to use this predicate to find all solutions with increasing magnitudes: for example, [here are the first 10 solutions for `42`](https://tio.run/##SypKTM6ozMlPN/pvbWjwqG3Do6bGh9sWPGrc9/9Rx3LTuhyfE8sfbp3wqHMpUAIo4hP3qKkZKKCnbQ/kPeqc8/@/idH/KAA)
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 11 bytes
Thanks Fatalize for saving one byte
```
~+l₅≥₁.√₃ᵐ∧
```
[Try it online!](https://tio.run/##ASwA0/9icmFjaHlsb2cy//9@K2zigoUu4oml4oKB4oia4oKD4bWQ4oin//9fNDL/Wg "Brachylog – Try It Online")
Firstly `~+` enforces that the output (`.`) must sum to the input. `l₅` again constrains the output, dictating that it must have a length of 5. `≥₁` declares that the list must be in decreasing order (I believe that this is necessary to stop the program entering an infinite loop)
We explicitly unify this list with `.`, the output variable, because our next predicate will "change" the values inside the list. We then take the cube root of each value in the list with `√₃ᵐ`. Since Brachylog is inherently integer-based, this dictates that all the numbers in the list are cube numbers.
Finally, we use `∧` because there is an implicit `.` added to the end of each line. Since we don't want `.` to be unified with the list of cube roots, we unified it earlier on and use `∧` to stop it unifying at the end.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~58~~ ~~57~~ 54 bytes
```
def f(n):k=(n**3-n)/6;return[v**3for v in~k,1-k,n,k,k]
```
[Try it online!](https://tio.run/##VctBCsIwEIXhvafIMikT7CQgVvEk4s4Gy@C0xLTQTa8eA2Kn3f28jzfM6dWzy/nZBhU0mwvdNFeVt2yOp2ts0xj5PpUh9FFNquOFAC0BAwE98hA7TuWIeDbwGd/6l@Yg0Ag0W3D1CiW3gAK4AyfgduAF/B9Wtlib/AU "Python 2 – Try It Online")
---
* -2 bytes, thanks to Rod
* -1 byte, thanks to Neil
[Answer]
# [Python 3](https://docs.python.org/3/), 65 bytes
```
def f(n):k=(n-n**3)//6;return[n**3,(k+1)**3,(k-1)**3,-k**3,-k**3]
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PyU1TSFNI0/TKttWI083T0vLWFNf38y6KLWktCgvGsTX0cjWNtSEMHQhDN1sOBn7Py2/SCFPITNPoSgxLz1VQ9fIQMfIQNOKizO5NCm12BZkOBdnQVFmXomGkmqxlWqxkqpGcWmuBlhaUwdCaf4HAA "Python 3 – Try It Online")
I mean, an explicit formula is even [here](https://math.stackexchange.com/a/1032601/328173) (although he abstracted the construction behind an existential)
[Answer]
# Java 8, ~~178~~ ~~87~~ ~~73~~ ~~71~~ 65 bytes
```
n->new long[]{n*n*n,(n=(n-n*n*n)/6+1)*n*n--,--n*n*n,n=-++n*n*n,n}
```
-6 bytes thanks to *@OlivierGrégoire*.
Same explanation at the bottom, but using the base equation instead of the derived one I used before (thanks to [*@LeakyNun*'s Python 3 answer](https://codegolf.stackexchange.com/a/161234/52210) for the implicit tip):
***k = (n - n3) / 6  
n == n3 + (k+1)3 + (k-1)3 - k3 - k3***
[Try it online.](https://tio.run/##LU/BTsMwDL3zFdZOCWnCduFACRIfwC47AoeQdZNL5kyJOzRN/faSLpVt@dmyn597d3G63/9OPric4cMh3R4AkLhLB@c72M4lQIh0/PwGL2YAJNvSHUsUz@wYPWyBwMJE@o26v2X@Ro/FGkFWkL5j@fSsNnJGWje69hqyWqkFjlNbac/DTyi0C/sl4h5ORZ3YccKZ28mq7BCTKHIBrd6s1y3gq61ZKXkfANhdM3cnEwc257LMgQSq1csXr1Rf/jcDYzDvKblrNhzrAUHGC5Ry@XSc/gE)
---
**Old 178 bytes answer:**
```
n->{for(long k=0,a,b,c,d;;){if(n==(a=n*n*n)+(b=(d=k+1)*d*d)+(c=(d=k-1)*d*d)-(d=k*k*k++)-d)return a+","+b+","+c+","+-d+","+-d;if(n==a-b-c+d+d)return-a+","+-b+","+-c+","+d+","+d;}}
```
[Try it online.](https://tio.run/##NZDBboQgEIbvfYqJJxDHuGfKvkH30mPTwwjasLq4UdykMT67HcVmgMkP/IH/u9OL8O66zfY0TfBBPixvAD7EZmzJNnDbJcBnHH34ASv4BILUvLny5DFFit7CDQIY2AJel3YYRT/w7c5UBRV1YQuntVx8K4IxgkzIuaQStRHOdOoic5c71vbQeGrcRc6llEQnxybOYwBSWZGp@ljtsaI7m04PENZolVP/FkwWTB5MpuRxel03nXI857rnHGec1@AdPJiGSMm/vkkmEnu6HYI3eKkqDf7dpM7fPC4wrN8pNo9ymGP5ZHPsg/AqYzyZCiUjlCe/dfsD)
**Explanation:**
I loop `k` from 0 upwards until a solution is found. In every iteration it will check these two equations:
* Positive `k`: *n == n3 + (k+1)3 + (k-1)3 - k3 - k3*
* Negative `k`: *n == n3 - (k+1)3 - (k-1)3 + k3 + k3*
**Why?**
Since ***n - n3 = n\*(1-n)\*(1+n)*** and then ***6|(n-n3)***, it can be written as ***n - n3 = 6k***.  
***6k = (k+1)3 + (k-1)3 - k3 - k3***.  
And therefore ***n = n3 + (k+1)3 + (k-1)3 - k3 - k3*** for some ***k***.  
[Source.](https://math.stackexchange.com/a/1032601/368863)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
```
‘c3µ;;C;~;³*3
```
[Try it online!](https://tio.run/##y0rNyan8//9Rw4xk40Nbra2dreusD23WMv7//7@hAQA "Jelly – Try It Online")
Figure out the formula independently. (x+1)3 + (x-1)3 - 2 × x3 == 6 × x.
---
```
 === Explanation ===
‘c3µ;;C;~;³*3   Main link. Input: (n).
‘               Increment.
 c3             Calculate (n+1)C3 = (n+1)×n×(n-1)÷6.
   µ            Start a new monadic link. Current value: (k=(n³-n)÷6)
    ;           Concatenate with itself.
     ;C         Concatenate with (1-k).
       ;~       Concatenate with bitwise negation of (k), that is (-1-k)
         ;³     Concatenate with the input (n).
           *3   Raise the list [k,k,1-k,-1-k,n] to third power.
                End of program, implicit print.
```
Alternative 13 bytes: [Try it online!](https://tio.run/##y0rNyan8//9Rw4xk40Nbra2dresOb7DWMv7//7@hAQA "Jelly – Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/octave/), ~~47~~ ~~40~~ 33 bytes
```
@(n)[k=(n^3-n)/6,k,-k-1,1-k,n].^3
```
[Try it online!](https://tio.run/##bYvBCgIhFEX3fcXbiEpPU4SoCaH/mGZAIkFkXjFp0Nebs29zuHDued5L@Dxa9FrrdhUkx@wFzU6RPBwxo8rKolUZadKzawU8KGsGay67sK7hGyuJLXutiUoUnLk0sHOCPbDTP3rojxtxHAlj7/BdF7ENOUksyGtXRkL7AQ "Octave – Try It Online")
Saved 6 bytes thanks to Giuseppe, since I had forgotten to remove some old parentheses. Saved another bytes by changing the signs, thanks to rafa11111.
Uses the formula in the linked [math.se post](https://math.stackexchange.com/a/1032601/92515):
1. Since **n - n^3 = n(1-n)(1+n)** then **6 | (n - n^3)** and we can write **n - n^3 = 6k**.
2. **6k = (k+1)^3 + (k-1)^3 - k^3 - k^3**.
It appears to be longer if I try to *solve* the equation: **(n-n^3)=(k+1)^3 + (k-1)^3 - k^3 - k^3** with regards to **k**, instead of just using the equation.
[Answer]
# Minecraft Functions (18w11a, 1.13 snapshots), 813 bytes
[![perfect cubes in minecraft](https://i.stack.imgur.com/NFzwQ.png)](https://i.stack.imgur.com/NFzwQ.png)
Uses six functions:
a
```
scoreboard objectives add k dummy
scoreboard objectives add b dummy
scoreboard objectives add c dummy
scoreboard players operation x k = x n
function d
function f
scoreboard players operation x k -= x b
scoreboard players set x b 6
scoreboard players operation x k /= x b
scoreboard players set x b 1
function d
scoreboard players operation x c += x b
function f
scoreboard players set x b 1
function d
scoreboard players operation x c -= x b
function f
function d
function e
scoreboard players operation x b -= x c
scoreboard players operation x b -= x c
function c
function b
```
b
```
tellraw @s {"score":{"name":"x","objective":"b"}}
```
c
```
scoreboard players operation x b *= x c
scoreboard players operation x b *= x c
function b
```
d
```
scoreboard players operation x c = x k
```
e
```
scoreboard players operation x b = x c
```
f
```
function e
function c
```
"Takes input" from a scoreboard objective named `n`, create it with `/scoreboard objectives add n dummy` and then set it using `/scoreboard players set x n 5`. Then call the function using `/function a`
Uses the formula from [this math.se answer](https://math.stackexchange.com/a/1032601/249082)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 48 45 bytes
* thanks to @Arnauld for reducing 3 bytes
```
n=>[n,1-(k=(n**3-n)/6|0),~k,k,k].map(x=>x**3)
```
[Try it online!](https://tio.run/##TYlBDoIwEADvvoJjl7SwrQumh/IRwqFBMApsiRDDwfj12ptmLpOZh3/5rX/e111xuA5xdJFd07LUSkxOcJ6fFUNZvxHkZ5KJrlj8Kg7XHOlB7ANvYR6KOdzEKJRGgNN/a1NClBlVFzK2TkIaLZHMFJE12lQ/6yB@AQ "JavaScript (Node.js) – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 21 bytes
```
|_G|&:5Z^3^t!sG=fX<Y)
```
This tries all 5-tuples of numbers from the set `(-abs(n))^3, (-abs(n)+1)^3, ..., abs(n)^3`. So it is very inefficient.
[Try it online!](https://tio.run/##y00syfn/vybevUbNyjQqzjiuRLHY3TYtwiZS8/9/XUMDAA "MATL – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~43~~ 42 bytes
```
p n|k<-div(n^3-n)6=map(^3)[n,-k-1,1-k,k,k]
```
Just the popular answer, translated to Haskell. Thanks to @rafa11111 for saving a byte!
[Try it online!](https://tio.run/##y0gszk7Nyfn/v0AhrybbRjcls0wjTzcvzljTzDY3sUADyIjO08nWNtTJ1jXU0c0Gotj/uYmZeQq2Choxebp2CgVFmXklChpA/Zp2dlBOcWmuCkhAU0FD19BA8z8A "Haskell – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
```
ḟo=⁰Σπ5m^3İZ
```
[Try it online!](https://tio.run/##AR8A4P9odXNr///huJ9vPeKBsM6jz4A1bV4zxLBa////LTEw "Husk – Try It Online")
Tries all possible lists of 5 cubes, and returns the first one with the correct sum.
### Explanation
```
ḟo=⁰Σπ5m^3İZ
          İZ    List of all integers [0,1,-1,2,-2,3,-3...
       m^3      Cube of each integer [0,1,-1,8,-8,27,-27...
     π5         Cartesian power with exponent 5. This returns a list of all possible
                lists built by taking 5 elements from the input list. This infinite
                list is ordered in such a way that any arbitrary result occurs at a 
                finite index.
ḟo              Find and return the first element where...
    Σ             the sum of the five values
  =⁰              is equal to the input
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 85 81 75 bytes
Saved 4 bytes and then 6 bytes thanks to @ceilingcat's re-ordering of assignments
```
r[5];f(n){r[1]=(n=(n-(*r=n*n*n))/6+1)*n*n--;r[3]=r[4]=-n*n*n;r[2]=--n*n*n;}
```
[Try it online!](https://tio.run/##VY/PDoIwDMbP8BSLicnGtgj@O4h7krmDQWY4UEzhJOHZsZ1ezJrla39t@rWxz6ZZV/SnUEcJakZfBSeBwsoCHRT0lNqddaVYWlujPwSH/hicTZQKe9K/ZFn7ewdS5XOexQFlB5MA4YStyrImdXXiq7RWYmrHiZbW@ZInmZrTaN/2YztJNKUZu3c7RGaqOFFvFtNI9kIqRbkBt31cxPbxF46@G2wMGPRlMHyVYZ@G3Rt2n4BmoBloBpoB21k/ "C (gcc) – Try It Online")
[Answer]
# [Fortran (GFortran)](https://gcc.gnu.org/fortran/), 53 bytes
```
READ*,N
K=(N**3-N)/6
PRINT*,(/N,1-K,-1-K,K,K/)**3
END
```
[Try it online!](https://tio.run/##S8svKilKzNNNT4Mw/v8PcnV00dLx4/K21fDT0jLW9dPUN@MKCPL0C9HS0dD30zHU9dbRBRFAqK8JVMHl6ufy/78pAA "Fortran (GFortran) – Try It Online")
Fortran outgolfing Python? What's going on here?
[Answer]
# Python 3, ~~65~~ ~~61~~ 60 bytes
```
lambda N:[n**3for k in[(N**3-N)//6]for n in[N,-k-1,1-k,k,k]]
```
Edit: dropped some unnecessary spaces.
Edit: thanks to rafa11111's smart reordering. 
Inspired by [this](https://math.stackexchange.com/a/1032601/339905).
[Try it online!](https://tio.run/##FclBCoAgEIXhfaeYpYpSErQQuoIXKBdGWYM1hbTp9Ka81fu/53uPm/ocxjmf/lpWD9ZMJEQf7gQRkCZmy1OWt@3gaqQarVRRaalVlGXO5SpYBJKnfWOFOs1NA09CehnKwJDz/AM)
[Answer]
# [R](https://www.r-project.org/), ~~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!](https://tio.run/##K/r/P1kjz0a3ODkxT0NTJ9tGVyMvzlg3T1PfTCdbx1A3W0c3W9dQM874v66hwX8A)
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~30~~ 26 bytes
```
3*⍨⊢,∘(1 ¯1∘+,2⍴-)6÷⍨⊢-*∘3
```
[Try it online!](https://tio.run/##fU69DgFBEO49xXT2fjasE50HUHmGw/nJnezm1hUiWrmIFY1Eo1HJNQpEpeFN5kXOZKkVM5lvvp98oUr4YB4mclTidt/p4mpXBzRHGMoUBhOtknAOKkuV1JEu@1kv0iQJXDRnXJ98zA9MwOsi6PD8Bpobd1rvx5flLn2DslSplENyLbwa5ms0dxZ7wmExp2UtMZE/l7lzGjdw3GBpe1gztEFnU6BjNo7Atqjg5ommYBa8zpgXDM21IRyfYrglf6ggwGzMf1lTUJdqu/oB)
APL translation of [LeakyNun's answer](https://codegolf.stackexchange.com/a/161234/74163).
Thanks to Adám for 4 bytes by going tacit.
### How?
```
3*⍨⊢,∘(1 ¯1∘+,2⍴-)6÷⍨⊢-*∘3 ⍝ Tacit function
                   6÷⍨⊢-*∘3 ⍝ (n-n^3)/6 (our k)
                 -)         ⍝ Negate
               2⍴           ⍝ Repeat twice; (yields -k -k)
       (1 ¯1∘+,             ⍝ Append to k+1, k-1
     ,∘                     ⍝ Then append to
    ⊢                       ⍝ n
3*⍨                         ⍝ And cube everything
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 20 bytes
```
m^3m‼:_:→:←;K¹÷6Ṡ-^3
```
[Try it online!](https://tio.run/##yygtzv7/PzfOOPdRwx6reKtHbZOAeIK196Gdh7ebPdy5QDfO@P///7qGBgA "Husk – Try It Online")
Uses the formula from [this post](https://math.stackexchange.com/questions/207366/can-any-integer-can-be-written-as-the-sum-of-8-integer-cubes/1032601#1032601).
### Explanation
```
m^3m‼:_:→:←;K¹÷6Ṡ-^3  Implicit input
                Ṡ-    Subtract itself from it
                   ^3    raised to the third power
              ÷6       Divide by six
   m                   Map over the value with a list of functions:
           ;             Create a singleton list with
            K¹             the function of replace by the input
         :←              Append the function of decrement
       :→                Append the function of increment
    ‼:_                  Append the function of negate twice
m^3                    Cube the numbers of the list
```
[Answer]
# x86, ~~41~~ 39 bytes
Mostly straightforward implementation of the formula with input in `ecx` and output on the stack. 
The interesting thing is that I used a cubing function, but since [`call label` is 5 bytes](https://stackoverflow.com/q/49700798/3163618), I store the label's address and use the 2 byte `call reg`. Also, since I'm pushing values in my function, I use a `jmp` instead of `ret`. It's very possible that being clever with a loop and the stack can avoid calling entirely. 
I did not do any fancy tricks with cubing, like using `(k+1)^3 = k^3 + 3k^2 + 3k + 1`. 
Changelog:
* Fix byte count using `not` instead of `neg`/`dec`.
* -2 bytes by not `xor`ing `edx` since it is probably 0 from `imul`.
```
.section .text
.globl main
main:
        mov     $10, %ecx   # n = 10
start:
        lea     (cube),%edi # save function pointer
        call    *%edi       # output n^3
        sub     %ecx, %eax  # n^3 - n
                            # edx = 0 from cube
        push    $6
        pop     %ebx        # const 6        
        idiv    %ebx        # k = (n^3 - n)/6
        mov     %eax, %ecx  # save k
        call    *%edi       # output k^3
        push    %eax        # output k^3
        not     %ecx        # -k-1        
        call    *%edi       # output (-k-1)^3
        inc     %ecx        
        inc     %ecx        # -k+1
        call    *%edi       # output (-k+1)^3
        ret
cube:                       # eax = ecx^3
        pop     %esi 
        mov     %ecx, %eax
        imul    %ecx
        imul    %ecx
        push    %eax        # output cube
        jmp     *%esi       # ret
```
Objdump:
```
00000005 <start>:
   5:   8d 3d 22 00 00 00       lea    0x22,%edi
   b:   ff d7                   call   *%edi
   d:   29 c8                   sub    %ecx,%eax
   f:   6a 06                   push   $0x6
  11:   5b                      pop    %ebx
  12:   f7 fb                   idiv   %ebx
  14:   89 c1                   mov    %eax,%ecx
  16:   ff d7                   call   *%edi
  18:   50                      push   %eax
  19:   f7 d1                   not    %ecx
  1b:   ff d7                   call   *%edi
  1d:   41                      inc    %ecx
  1e:   41                      inc    %ecx
  1f:   ff d7                   call   *%edi
  21:   c3                      ret    
00000022 <cube>:
  22:   5e                      pop    %esi
  23:   89 c8                   mov    %ecx,%eax
  25:   f7 e9                   imul   %ecx
  27:   f7 e9                   imul   %ecx
  29:   50                      push   %eax
  2a:   ff e6                   jmp    *%esi
```
---
Here is my testing version that does all the cubing at the end. After the values are pushed on the stack, the cube loop overwrites stack values. It's currently ~~42~~ 40 bytes but there should be some improvements somewhere. 
```
.section .text
.globl main
main:
        mov     $10, %ecx       # n = 10
start:
        push    %ecx            # output n
        mov     %ecx, %eax
        imul    %ecx
        imul    %ecx
        sub     %ecx, %eax      # n^3 - n
                                # edx = 0 from imul
        push    $6
        pop     %ecx            # const 6        
        idiv    %ecx            # k = (n^3 - n)/6
        push    %eax            # output k
        push    %eax            # output k
        not     %eax            # -k-1        
        push    %eax            # output -k-1
        inc     %eax            
        inc     %eax            # -k+1
        push    %eax            # output -k+1
        dec     %ecx            # count = 5
        add     $20, %esp
cube:           
        mov     -4(%esp),%ebx   # load num from stack
        mov     %ebx, %eax
        imul    %ebx
        imul    %ebx            # cube 
        push    %eax            # output cube
        loop    cube            # --count; while (count)
        ret
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 43 bytes
```
->n{[~k=(n**3-n)/6,1-k,n,k,k].map{|i|i**3}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6vOrou21YjT0vLWDdPU99Mx1A3WydPJ1snO1YvN7GguiazJhMoV1v7P0/BVkHX0ICLq0AhLTovFkrpFZfmKtjaKuT9BwA "Ruby – Try It Online")
[Answer]
# [Cubically](https://github.com/aaronryank/cubically), 51 characters, 55 bytes
```
⇒-6-^0+7/0»8
$F:^0%@5-7/0»8^0%@5%@5f1+8^0%@5f1-8^0%
```
[Try it online!](https://tio.run/##Sy5NykxOzMmp/P//UfskXTPdOANtc32DQ7stuFTcrOIMVB1MdSF8MBuI0gy1Iew0Q10Q4/9/UwA "Cubically – Try It Online")
Apparently MDXF forgot to implement the SBCS...
[Answer]
# [Unefunge 98](https://esolangs.org/wiki/Funge-98), 35 bytes
```
j&3k:**-6/:1-\:1+\0\-::!#@_::**.37*
```
[Try it online!](https://tio.run/##K81LTSvNS0/VtbTQLagEM///z1IzzrbS0tI107cy1I2xMtSOMYjRtbJSVHaItwKK6xmba/3/b6IAAA "Unefunge-98 (PyFunge) – Try It Online")
It uses the popular formula from [this math.se answer](https://math.stackexchange.com/a/1032601/249082).
[Answer]
# Perl 5 `-nE`, 48 bytes
```
say$_**3for$i=($_**3-($n=$_))/6,$i,-1-$i,1-$i,$n
```
[hat-tip](//math.stackexchange.com/a/1032601)
[Answer]
# [PowerShell Core](https://github.com/PowerShell/PowerShell), 52 bytes
```
$o,(1-($k=($o*$o-1)*$o/6)),(-$k-1),$k,$k|%{$_*$_*$_}
```
[Try it online!](https://tio.run/##VZHfS8MwEMefm7/iGBkk2zLXB0UcA1@cvoyJFXwQmbEeLFvb1CbFybq/vV7qHArHkfvx/eRyKe0nVm6NWaZSW2E7r4vUG1vAIzovJNuziKfaoYMZXAs5ZVE8HscTaKAPeziWhjO4Ra8edPFuc1ALvTN5ncP5hM6m6M7xFA4sOsE6OYsirgtHAxB8bi3w1TTkjFton64pKX7rDSxQu7pCtXzbYOpBJQRtIMGsi252JV1@X9kSK/8FVJSg8ONIDFBb@7L2xDwi1caaAnowhF5oeaqMR3VnnYfeaQBaA1/BqxfkSfiDkKH/wNgfCfsnT3ReZgjLrvsqdIe3XTLSnLZLGfFsCv/CLe245XYkYiX4dia4HXCrYkn@7ELKkVB8S@GIb8ma/p6vBp0dWuKFT2q/AQ "PowerShell Core – Try It Online")
Uses the equation `o=o^3 + (1-k)^3 + (-k-1)^3 + k^3 + k^3`, where `k=o^3 - o`; this is a minor refactoring of the popular `l=o-o^3` (with `k=-l`).
As a side note, the expression `l=o-o^3` looks like a cat with a hurt ear.
]