[Question]
  [
From [Wikipedia](https://en.wikipedia.org/wiki/Gabriel%27s_Horn), Gabriel's Horn is a particular geometric figure that has infinite surface area but finite volume. I discovered this definition in [this Vsauce's video](https://www.youtube.com/watch?v=ffUnNaQTfZE&t=22s) (starting at 0:22) where I took the inspiration for this problem.
You begin with a cake (a cuboid) of dimension \$x \times y \times z\$. In your first slice of the cake, you will end up with two smaller cakes of dimension \$\frac{x}{2} \times y \times z\$. Next, you will slice **only one** of the two pieces of cake you sliced previously, and so on. The picture below illustrates this:
[![enter image description here](https://i.stack.imgur.com/5yl7W.png)](https://i.stack.imgur.com/5yl7W.png)
# Task
I cannot believe that the surface area can grow infinitely even if the volume of the cake stays the same and your task is to prove me that! However, I trust you and if you show me that the first 10 slices of the cake that the surface area is really growing, I will believe you.
You will receive the initial \$x \times y \times z\$ dimension of the cake as input and will output a list of 10 values referring to the total surface area of all cuboids after each consecutive slice.
# Specs
* The cake will always be sliced in half and it will always be sliced in the same dimension.
* The surface area \$S\$ of a cuboid of dimension \$x \times y \times z\$ is: \$S = 2xy + 2xz + 2yz\$
* The outputted list should first start with the surface area after no slices (that is, the cuboid original surface area), then 1 slice and so on.
* The slices are going to be done in the \$x\$ dimension and the test cases below will assume this.
* The surface area you have to calculate includes all pieces of cake sliced in previous iterations.
* Input is flexible, read it however you see fit for you.
* Standard loopholes are not allowed.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins
# Test Cases
```
Format:
x, y, z --> output
1, 1, 1 --> [6, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0]
1, 2, 3 --> [22, 34.0, 46.0, 58.0, 70.0, 82.0, 94.0, 106.0, 118.0, 130.0]
3, 2, 1 --> [22, 26.0, 30.0, 34.0, 38.0, 42.0, 46.0, 50.0, 54.0, 58.0]
7, 11, 17 --> [766, 1140.0, 1514.0, 1888.0, 2262.0, 2636.0, 3010.0, 3384.0, 3758.0, 4132.0]
111, 43, 20 --> [15706, 17426.0, 19146.0, 20866.0, 22586.0, 24306.0, 26026.0, 27746.0, 29466.0, 31186.0]
1.3, 5.7, 21.2 --> [311.62, 553.3, 794.98, 1036.6599999999999, 1278.3400000000001, 1520.02, 1761.6999999999998, 2003.38, 2245.06, 2486.74]
```
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~9~~ 8 bytes
```
ṙ1×æ.Ɱ⁵Ḥ
```
[Try it online!](https://tio.run/##TZG9TgMxDMf3PsU9QBsljhPnFt4CJIQ6sqBObGwtCzsMgARCAtQJISEBasV46oPkXuTwR6GN7izf2f7Zf@fsdDa7GIa6vg/dbbd0/cd7v/iqq9dhc1PXL/38oZlMDpp@/lhXz3X11C@@jw67q255Dpvrur4b1Z/P7qq/fDsehjBu5NGCkzxuivP86dWCWlSb1WoUNAoaBY5OR0yAcRMNAuJqEWpR0iLSoqJFrSG9MQ0aohdSVFLYkUCTolYbNWo@wl4HjSb86zYdkXD5JQNRzvIDTVbaSirF5EA2KTlue5n8GIv1I1OAIYKKFTLKoN7oIZEXPqENG9pgc4Ev2RxIxRyMphqyt2Qg2ia3aMmRN5K1keMmybEWCA6sFwdd5rWkFCVKvMq2yC559pza3ZHro@Ii@v8jC0lyebJhygzayy8yrmeoOIDJiSRAnoRw@gs "Jelly – Try It Online")
Takes input as `[z, y, x]` as [allowed by OP](https://codegolf.stackexchange.com/questions/226022/convince-me-gabriels-horn-is-possible#comment522510_226022).
-1 byte thanks to [Nick Kennedy](https://codegolf.stackexchange.com/users/42248/nick-kennedy)
We calculate
$$2\left( \begin{matrix} z\times y \\ y\times x \\ x\times z\end{matrix} \right) \cdot \left( \begin{matrix} i \\ 1 \\ 1 \end{matrix} \right) = 2(yzi + yx+xz)$$
for each \$1 \le i \le 10\$
## How it works
```
ṙ1×æ.Ɱ⁵Ḥ - Main link. Takes [z, y, x] on the left
ṙ1       - Rotate once left; [y, x, z]
  ×      - Product; [yz, xy, xz]
      ⁵  - Yield 10
     Ɱ   - For each integer 1 ≤ i ≤ 10:
   æ.    -   Dot product. Pad to [i, 1, 1] and calculate
              [yz, xy, xz] . [i, 1, 1] = yzi+xy+xz
       Ḥ - Double each
```
[Answer]
# [Haskell](https://www.haskell.org/), 37 bytes
```
(x#y)z=[2*(x*y+x*z+n*y*z)|n<-[1..10]]
```
[Try it online!](https://tio.run/##TZFNb9swDIbv/hVCFyCyY2sS9eks6WnH3XcwfHARbzWWOEaSAomx/55JZLrWsAnKJB/ypV67859@v7/f@fXLLZ@3DRT8WtxW12JejcWtmPO/46ZqlBBKtu390A3jdnfMGB/KY76pfh26ie9Ox4npXJynbuRft8tqmW8Wz7/7y49h7DO27y/NtbyVc7s99d1usWyW62G1emqf1uvm@/HtZd@33zqMsUieTsN44Xyj@krJCH07LLqXcwTOw/RzuLzyKu84TZuXyC0fp4yl8e6qZOllVfXMGleyIGQ8SrSA1qB1aDEKGAWMQoy2WSRAyTRBILlYZLDIYpHHooBFNSElMQmqtEwkjST1QQJM0lhNVI35Bj51wKg1793azCdu/DyBvHPphyFZ9iEpBJIDjqQ4/ehF8rUO1M@TAqM0oNhENmlQSXRlvUx8b2hYVSuaC2Rw5IAN5BhNqsFJSgbvH8m1oWQdN@KwkYhNrIhaQAmgXjEoXFyLtTpFfVxlHdIu4@zO1h9Puj4fhDby/5MWYtPlpQ17F0Gf8kMaV0ZocsBYkSSBiZN40/4D "Haskell – Try It Online")
The relevant function is `(#)`, which takes as input `x`, `y`, `z` in this order and outputs the areas of the first 10 iterations.
[Answer]
# [R](https://www.r-project.org/) >= 4.1.0, ~~39~~ 28 bytes
```
\(x,y,z)2*(1:10*y*z+x*y+x*z)
```
[Try it online!](https://tio.run/##K/qfZvs/rTQvuSQzP0@jQqdSp0rTSEvD0MrQQKtSq0q7QqsSiKs0/6dpmOsoGBoCsbnmfwA "R – Try It Online")
Note the TIO link has `function` in place of `\` since TIO is running an older version of R. However, the functionality is identical.
A function taking `x`, `y` and `z` and returning a vector of the surface areas.
Saved 11 bytes by looking at [Delfad0r’s Haskell answer](https://codegolf.stackexchange.com/a/226024/42248) (and so using a much similar formula with no non-operator functions!)
[Answer]
# [Zsh](https://www.zsh.org/), 43 bytes
```
eval '<<<$[2*($1*$2+$1*$3+$2*$3*'{1..10}\)]
```
[Try it online!](https://tio.run/##qyrO@F@cWqJgrmBoqGBo/j@1LDFHQd3GxkYl2khLQ8VQS8VIG0Qaa6sYAUkt9WpDPT1Dg9oYzdj//wE "Zsh – Try It Online")
`eval '...'{1..10}\)]`: evaluate the command `<<<$[2*($1*$2+$1*$3+$2*$3*N)]` repeated with `1` to `10` in place of `N`. No semicolons needed, because `<<<` can be chained implicitly.
[Answer]
# [Factor](https://factorcode.org/), 56 bytes
```
[ 3dup [ * ] 2tri@ 10 [1,b] [ 4dup * + + 2 * nip ] map ]
```
[Try it online!](https://tio.run/##bVJNT8MwDL3vV5grH1HifBYkxA1x4YI4TTuU0kHF6EpbDmjabx@OXUYlSCQ38nPes1@zLqtx2x8eH@7uby/hre7begPv5fiq@rJ9qQfYbKtyM8BQf3zWbUWJDELX1@P41fVNO8LVYrFbAK0dGN57mNYJXFxTNgAkpQGM5ogcHcfAkVFkFBnFjO6PpAj2DykigGUSxySeSSKTJCYpREKLhogYq2fMlpjNv8zIl7h4UrF83@FMkVHvjuo/tJHUwMQf4ok2hpDbcGKCnwxISYbHIIMHOymLWdYmUY8ynzMW59aQkKMptGhNSsZHnbWikzFMYaRj1CnIAX2Sg7PiDwYtxRjjVFw4KbbkXZiLKgteRUCjkHQnUapSgZzz3hIOkdwvUrafBgq@@F35BcSkrNPHZbIh@f9j7joQ0aw@5b41keYDOq/ybOiopeiop/1hCfb5s4MlnMIKcOybG1KFpTl/WlHSZewUzmgjfdumo6r3kiJdXDf9MFpK0HvutkPNwDCW1ZuCalOX/eEb "Factor – Try It Online")
*Data flow combinator version thanks to @Bubbler*
The interesting thing about Factor is you generally have four ways to approach golf: dataflow combinators, stack shuffling, local variables, and "sequence-y" (making heavy use of `math.vectors` and other sequence words). The thing about dataflow combinators is that despite keeping the data stack static and easier to reason about, they're almost always longer than the other three methods. However, once in a while they will win out over the others for some reason, and it's not always clear which will win until you give them all a try.
# [Factor](https://factorcode.org/), 57 bytes
```
[| x y z | 10 [1,b] [ y z * * x z * x y * + + 2 * ] map ]
```
[Try it online!](https://tio.run/##bZJNT8MwDIbv@xXmOiBKnM@CxBVx4YI4TTuUqYNpoxttkTa2/fbh2GVUgkRKo9h5H/tt5uWsWzen56eHx/sbWFZNXa3gvezeVFPWr1ULq/WsXLXQVh@fVT2jgxyETVN13W7TLOoObkej/Qho7MHwPEI/LuD6jk4DQFIawGhekVfHa@CVo8hR5Cjm6PEsimD/iCICWBZxLOJZJLJIYpFCEFoYAjFWD5QtKZt/lZEvcXJPsXzf4YDIUe/O9B/ZSDQw8Ue4l40h5DKcmOB7A1KS5jFI48H2ZDHL2iT0KP05Y3FoDYEcdaGF1ZOMjzqzopM2TGGkYtQpyAZ9ko2z4g8GLckYY59cOEm25F0YQpUFryKgUUjcHkpZKpBz3luKQyT3i5Ttp4aCL35HfgExKev0eZhsSP7/mKsOJDTIT7luTaJ5g86r3Bs6Kik6qul4mhxgCzv4ggPRYGKuXqYw4YMxzS1/c8IYLmkifaf0iDcwPU1gvmjaztIBPejNuq040HblbKlO3w "Factor – Try It Online")
*Locals*
# [Factor](https://factorcode.org/), 60 bytes
```
[ 10 [1,b] [ '[ 1 _ 1 ] over 1 rotate v* v. 2 * ] with map ]
```
[Try it online!](https://tio.run/##bVLLbhsxDLz7K9hTAKMVJOq5CZBrkEsvRU@GUWwNJTEcPyKrbg3D3@5S5MZZoOViCUqkZsiRnvpF3ZbL92@PXx9uYd3XF1X6zXPew1M5wiqXTX6FfX77lTcL2rxGKv@ppd/LiUNuILKAXcm1HndlualwN5mcJkB2AsPfGQb7BF/uaTcAJKUBjGaP7B37wJ6zyFnkLLbs@QqKYP8BRQSwDOIYxDNIZJDEIJ1QaOEQEmP1CNkSsvkvMvIhLh5YLJ93OGLkrHdX9nfYSGxg4jvwABtDaG04EcEPAqQkw2OQwYMdmEUsa5OwR5nPGYtjaYjI0RRauAYm46NuXNHJGKYz0jHqFCRAnyRwVvTBoKUYYxyKOyfFlrQLY1JlwasIaBQS70BKVSqQct5bykMk9bvU5KeBgu8@rL2AmJR1@mqmCdLuH1vXgYBG9an1rQm0Bei8arOho5aio57OlxmRwMx8/jmHGdzQCn7QP4ftIRcKyrb2NcNhCgdF9z2lzO8lPeF1v4P5pfl97RcrdfkL "Factor – Try It Online")
*"Sequence-y"*
[Answer]
# [Mathematica](https://www.wolfram.com/mathematica/), 29 bytes
```
2*(#*#2+#*#3+#2*#3*Range@10)&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n6ZgqxDz30hLQ1lL2UgbSBhrKxsBSa2gxLz0VAdDA021/wFFmXkl0WnRhjpGOsaxsf8B)
[Answer]
# [JavaScript (SpiderMonkey)](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/45), 48 bytes
```
(x,y,z)=>{for(i=22;i-=2;)print(2*x*(y+z)+i*y*z)}
```
[Try it online!](https://tio.run/##BcFBCoAgEADAr3TcVYPcuoX9JUphi1QsIo3ebjPbfM/nkjhe7Rl5tekIfre5OlPhUVkVNNPrQgI2RCO3hkaMif0FJB4BWRaULLIo@FUHWmvVDL1qqMP6Aw "JavaScript (SpiderMonkey) – Try It Online")
[Answer]
# JavaScript, 53 bytes
Output is a space delimited string with a leading space.
```
x=>y=>g=(z,n=11)=>--n?g(z,n)+` `+(n*y*z+x*y+x*z)*2:``
```
[Try it online!](https://tio.run/##FcdBCoAgEADAr3Tc1QysW7D2FaNUilijItLPWx3mMOt4j@d0LPulOM6ueCoPmUQmEOSaSWskoxQP4S9KW1kJLJLI8hHpk1G0vbVlinzGzTVbDOChQ2gRNGJ5AQ)
Or 52 bytes using commas instead of spaces:
```
x=>y=>g=(z,n=11)=>--n?g(z,n)+[,(n*y*z+x*y+x*z)*2]:[]
```
[Try it online!](https://tio.run/##FcdLCoAgEADQ68xYBtYuGDuIuIg@UsQYGaFe3mrxFm8fnzFM13bekv28lJVKJJ1IO4JcMymFpKXkwf3FytTAIolcRZE@GUVre2PL5Dn4Y2kO72CFDqFFUIjlBQ)
[Answer]
# [J](http://jsoftware.com/), 23 bytes
```
(2*+/+i.@10*1&{)@:*1&|.
```
[Try it online!](https://tio.run/##bY9NigJBDIX3niK4UFvbmJ@qVHXDgDDgypVXkGlGNx5A796mSlEXBsILrx5fUudxivMBfnqYQwsEvfca4few340LWa42qxNumZY8uzbb3uWGYzP5O/5fYIDUArN3ehiLZFacQEiukUPVnHNREZOqplZUiWtONdecplhzgdVzDaz7LxuUGU1aiFFRW0hdwC77OznTYvcu9yRl1ECvKpwovlMK0Bz0kXeIEDm0DBIikn9FQjZM4XkLl40R/SRhlPEO "J – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 55 bytes
```
(x,y,z)=>[...Array(10)].map((_,i)=>2*(++i*y*z+x*y+x*z))
```
[Try it online!](https://tio.run/##DcnLCoAgEEDR3xl1GnqsC/qOiJBeGOaERaQ/by7u5txDv/qevbmewvGypq1N8GHAKNpuIKLeex2gKsVIp74AJjT51BKUMjLIqD4ZclGINLO72a5keYcNKqyxyfoD "JavaScript (Node.js) – Try It Online")
Someone will probably outgolf me with recursion, but I have not yet found a suitable way to do so yet. This is essentially just a port of most people's answers.
---
# [JavaScript (Node.js)](https://nodejs.org), 53 bytes
```
(x,y,z)=>[...Array(i=10)].map(_=>2*(x*y+x*z+y*z*i--))
```
[Try it online!](https://tio.run/##DchbCoAgEADA66ybLj2@DTpHREhpGJWhEerlrfmcXb0qLN7ej7jcqouRBSJPPDPZj0Q0eK8SWNnUbKJT3TDLvkWImKqIuUqY0QrBWFncFdyh6XAbGGh4y7t/Pw "JavaScript (Node.js) – Try It Online")
Outputs in reverse order
[Answer]
# [Python 3](https://docs.python.org/3/), 51 bytes
```
lambda x,y,z:[2*(x*y+x*z-~n*y*z)for n in range(10)]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaFCp1KnyiraSEujQqtSu0KrSrcuT6tSq0ozLb9IIU8hM0@hKDEvPVXD0EAz9n9BUWZeiUaahqEOEGpq/gcA "Python 3 – Try It Online")
-1 byte thanks to @dingledooper
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~70~~ 69 bytes
Saved a byte thanks to [EliteDaMyth](https://codegolf.stackexchange.com/users/100752/elitedamyth)!!!
```
f(x,y,z,i)float x,y,z;{for(;++i<11;)printf("%f ",2*(x*y+x*z+i*y*z));}
```
[Try it online!](https://tio.run/##jVPtbpswFP2fp7CQhoA4DH/D6PZn6lMsVRVR06J1pEoiDYjy6suufUnImrUqsi2be3zOubZvtXisquOxjjra04E2cf28Xu2IX5X7er2Jyvm8uWGsjF82Tburo@BTTQLKk6hL@nmXDPMm6ZMhjsvDEeLk16ppo3i2nxH4kGxnt7v77scd@Ur2jBJoghIDE@ZWqTiUr8H9Gcx9c0AJm1RqrsHDGSw8OQNqnkFnKR/R1dNqkxDbvdhqZx8QH2hK8hRwLPMj96P0o/ajj3If5T7KIRpQEnCwJDxSeqTySOORuUcWyJMhETIxkU3buY8IvwWphAdJfkHro0qeJNxeo7UjlOhZjX7zHL1yjT61GOkxNyFylDDoVDLBkY4pkzlCI9EQKxhq8yzXOOEqx4kUmA7XGYK5MSO4kAgWkKpGZpimGhJVSqTuuuFEitwdCVjTqpg@d/QmT4XMzp@7ROUO3l290UB0gc@duQxI3YRLlboEuARdI4N/7rt6stVPu4HrJv7Cl90tX3bFd@jKWbxYi9NOePEkcu@4aR9sB9uycpzekG0z2HUdnZ5R/Hn8kZz/lASKxaFjggUwPVXHNRaCR9yVrwD9CdC/ARhOgOEKMJUmJdjJ4htUKdQx6SkZ4gsurPSLP2NxAPu5QP5vwGbUMmo5tYJaSa2iVlNrqM2pLSbwdlutWjgmOOHJz0c6@A1BIwSREFRCkAlBJwShEJRCkApBK7RFfJ36sr0d3X9x6b/dli3ovJvKyH6YHY5/qvp59bg9Ln7/BQ "C (gcc) – Try It Online")
Prints out the surface areas starting at the beginning.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 41 bytes
```
{(A[1]×⍳10)++/1↓A←2×⍵×1⌽⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///v1rDMdow9vD0R72bDQ00tbX1DR@1TXZ81DbBCCS29fB0w0c9e4GM2v9pQMFHvX2Pupof9a551Lvl0HrjR20TH/VNDQ5yBpIhHp7B/9MUDEGQK03BSMEYTJvqmSsYGeoZKRjqGQMA "APL (Dyalog Unicode) – Try It Online")
* my 1st Apl answer, footer stolen.. Honestly I still can't completely understand it because haven't seen yet the SRC and THIS commands.
* input as Y Z X vector `⍵`.
```
A←2×⍵×1⌽⍵   U store in A input rotated once and multiplied by input and then doubled 
   Obtaining total a,b,c planes surfaces
+/1↓A   U sum of b,c planes which remains always the same
(A[1]×⍳10)+   U added to a plane multiplied by [1..10]range
```
[Answer]
# [Julia 1.x](http://julialang.org/), 32 bytes
```
(x,y,z)->2(x*y.+x*z.+(1:10)*y*z)
```
[Try it online!](https://tio.run/##VYvRCoMwDEXf/Yqwp6TWYOuGMJj/ImMyRXRIB7U/36VlgxmSkJx77/Sex974OMAtote7DlR1Fr3aufQqcInmampSuwoUh3V79PcnOqg6eG3j4uYFp3Vc0Gk4SZMMVCLKM6BjZiJdgBTmnS@jIfVX@CGroflHTUYHVyt/SraHaELn5K4PmAVdWCLWsKUsUEHxAw "Julia 1.0 – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 16 bytes
```
ＩＥχ⊗⁺Σ∕Πθθ×ιΠ…θ²
```
[Try it online!](https://tio.run/##Nck9C8IwEIDhv5LxAifYOjqmqxDQrXSISaAHV9N8Ffz1p4O@w7O8fnXFJ8cittCrgXG1wc3tMJxRTak/OQaw3Cvc@wYTHRQi2JJC9w2yRpX1lwdtsQKh@h/z9hzNmnbIqEb96yoyzwOOeFkWOR38AQ "Charcoal – Try It Online") Link is to verbose version of code. Takes an array `[z, y, x]` as input. Explanation:
```
  χ                 Predefined variable `10`
 Ｅ                  Map over implicit range
     Σ∕Πθθ          Half-area of initial cuboid
    ⁺               Plus
           ι        Number of cuts
          ×         Multiplied by
            Π…θ²    Half-area of each cut
   ⊗                Doubled
Ｉ                   Cast to string
                    Implicitly print
```
[Answer]
# Ruby 2.7+, 39 bytes
```
->x,y,z{(1..10).map{2.*_1*y*z+x*y+x*z}}
```
Requires ruby 2.7+ for numbered arguments to work.
[Answer]
# [Raku](https://github.com/nxadm/rakudo-pkg), [63 bytes](https://tio.run/##K0gtyjH7n1upoJKmYPu/WiPO0EDh0G6tQ7s1orViFRziow11jGI1gULah3ZHa4NFDHQMdAxjo7QgklBpoA6j2v/WXCppGuY6hoY6huaaesWJlf8B "Perl 6 – Try It Online")
```
{(^10 »*»([*] @_[1,2]) »+»[+] @_[0,0,1]Z*@_[1,2,2]) »*»2}
```
Hyper-operators galore here leveraging constant difference between consecutive slicings of `2*y*z`:
* `^10` generates `0..9` ...
* `»*»` multiplies each integer in the sequence by ...
* `[*] @_[1,2]` is `y*z`
* `»+»` then adds to each of element in the sequence ...
* `[+] @_[0,0,1] Z* @_[1,2,2]`, which computes `x*z + x*y + y*z`
* `»*»2` then multiplies the resultant list by 2
[Answer]
# [Desmos](https://desmos.com/calculator), 28 bytes
```
f(x,y,z)=2(xz+xy+[1...10]yz)
```
[Try It On Desmos!](https://www.desmos.com/calculator/d92yz3mog8)
[Try It On Desmos! (Prettified)](https://www.desmos.com/calculator/4qmba5qr9s)
]