Skip to main content
edited body
Source Link
totallyhuman
  • 17.3k
  • 3
  • 32
  • 88

,,,, 12 bytes

↻5×↻4×↻3×↻-#

Explanation

Take input 4, 3, 2, 1 for example.

↻5×↻4×↻3×↻-#

              implicit input                  [4, 3, 2, 1]
↻             rotate the stack clockwise      [1, 4, 3, 2]
 5            push 5                          [1, 4, 3, 2, 5]
  ×           pop 2 and 5 and push 2 * 5      [1, 4, 3, 10]
   ↻          rotate the stack clockwise      [10, 1, 4, 3]
    4         push 4                          [10, 1, 4, 3, 4]
     ×        pop 3 and 4 and push 3 * 4      [10, 1, 4, 12]
      ↻       rotate the stack clockwise      [12, 10, 1, 4]
       3      push 3                          [12, 10, 1, 4, 3]
        ×     pop 4 and 3 and push 4 * 3      [12, 10, 1, 12]
         ↻    rotate the stack clockwise      [12, 12, 10, 1]
          -   pop 10 and 41 and push 10 - 41    [12, 12, 9]
           #  pop 12, 12, 9 and push the sum  [33]
              implicit output

,,,, 12 bytes

↻5×↻4×↻3×↻-#

Explanation

Take input 4, 3, 2, 1 for example.

↻5×↻4×↻3×↻-#

              implicit input                  [4, 3, 2, 1]
↻             rotate the stack clockwise      [1, 4, 3, 2]
 5            push 5                          [1, 4, 3, 2, 5]
  ×           pop 2 and 5 and push 2 * 5      [1, 4, 3, 10]
   ↻          rotate the stack clockwise      [10, 1, 4, 3]
    4         push 4                          [10, 1, 4, 3, 4]
     ×        pop 3 and 4 and push 3 * 4      [10, 1, 4, 12]
      ↻       rotate the stack clockwise      [12, 10, 1, 4]
       3      push 3                          [12, 10, 1, 4, 3]
        ×     pop 4 and 3 and push 4 * 3      [12, 10, 1, 12]
         ↻    rotate the stack clockwise      [12, 12, 10, 1]
          -   pop 10 and 4 and push 10 - 4    [12, 12, 9]
           #  pop 12, 12, 9 and push the sum  [33]
              implicit output

,,,, 12 bytes

↻5×↻4×↻3×↻-#

Explanation

Take input 4, 3, 2, 1 for example.

↻5×↻4×↻3×↻-#

              implicit input                  [4, 3, 2, 1]
↻             rotate the stack clockwise      [1, 4, 3, 2]
 5            push 5                          [1, 4, 3, 2, 5]
  ×           pop 2 and 5 and push 2 * 5      [1, 4, 3, 10]
   ↻          rotate the stack clockwise      [10, 1, 4, 3]
    4         push 4                          [10, 1, 4, 3, 4]
     ×        pop 3 and 4 and push 3 * 4      [10, 1, 4, 12]
      ↻       rotate the stack clockwise      [12, 10, 1, 4]
       3      push 3                          [12, 10, 1, 4, 3]
        ×     pop 4 and 3 and push 4 * 3      [12, 10, 1, 12]
         ↻    rotate the stack clockwise      [12, 12, 10, 1]
          -   pop 10 and 1 and push 10 - 1    [12, 12, 9]
           #  pop 12, 12, 9 and push the sum  [33]
              implicit output
Source Link
totallyhuman
  • 17.3k
  • 3
  • 32
  • 88

,,,, 12 bytes

↻5×↻4×↻3×↻-#

Explanation

Take input 4, 3, 2, 1 for example.

↻5×↻4×↻3×↻-#

              implicit input                  [4, 3, 2, 1]
↻             rotate the stack clockwise      [1, 4, 3, 2]
 5            push 5                          [1, 4, 3, 2, 5]
  ×           pop 2 and 5 and push 2 * 5      [1, 4, 3, 10]
   ↻          rotate the stack clockwise      [10, 1, 4, 3]
    4         push 4                          [10, 1, 4, 3, 4]
     ×        pop 3 and 4 and push 3 * 4      [10, 1, 4, 12]
      ↻       rotate the stack clockwise      [12, 10, 1, 4]
       3      push 3                          [12, 10, 1, 4, 3]
        ×     pop 4 and 3 and push 4 * 3      [12, 10, 1, 12]
         ↻    rotate the stack clockwise      [12, 12, 10, 1]
          -   pop 10 and 4 and push 10 - 4    [12, 12, 9]
           #  pop 12, 12, 9 and push the sum  [33]
              implicit output