[Question]
  [
In this challenge you will write a function that takes a list (ordered set) containing real numbers (the empty list is an exception, as it has nothing) and calculates
$$f(x)=\begin{cases}1 & \text{if } |x|=0 \\ x\_1+1 & \text{if } |x|=1 \\
\log\_{|x|}\sum\_{n=1}^{|x|}{|x|}^{x\_n} & \text{otherwise}
\end{cases}$$
where \$|x|\$ is the length of list \$x\$ and \$x\_n\$ is the \$n^\text{th}\$ item in the list \$x\$ using 1-based indexing. But why is this called “logarithmic ***incrementation***”? Because there is an interesting property of the function:
$$f(\{n,n\})=n+1$$
Amazing, right? Anyways, let’s not go off on a tangent. Just remember, this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer wins! Oh, right, I forgot the legal stuff:
* Standard loopholes apply.
* In a tie, the oldest answer wins.
* Only numbers that your language can handle will be input.
### Test cases:
```
[] -> 1
[157] -> 158
[2,2] -> 3
[1,2,3] -> 3.3347175194727926933796024072445284958617665867248313464392241749...
[1,3,3,7] -> 7.0057883515880885509228954531888253495843595526169049621144740667...
[4,2] -> 4.3219280948873623478703194294893901758648313930245806120547563958...
[3,1,4] -> 4.2867991282182728445287736670302516740729127673749694153124324335...
[0,0,0,0] -> 1
[3.14,-2.718] -> 3.1646617321198729888284171456748891928500222706838871308414469486...
```
Output only needs to be as precise as your language can reasonably do.
  
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~22~~ 15 bytes
Anonymous tacit prefix function implementing $$f(x)=x\_1\cdot\big[1=\lvert x\rvert\big]+\log\_{\lvert x \rvert} \sum\_{n=1}^{\lvert x\rvert}1^{\lvert x\rvert-n}\cdot\lvert x\rvert^{x\_n}$$
```
(⊃×1=≢)+≢⍟1⊥≢*⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///X@NRV/Ph6Ya2jzoXaWoDiUe98w0fdS0FsrQedS36n/aobcKj3j6goke9ax71bjm03vhR28RHfVODg5yBZIiHZ/D/NAWgHFeago6hqTmQMtIxApKGOkY6xmDaGAhB4iZgcWMdQx0TIG2gA4YgET1DEx1dIz1zQwsA "APL (Dyalog Unicode) – Try It Online")
`(`
 `⊃` the first element
 `×` times
 `1=` whether (1) or not (0) one equals
 `≢` the length of the argument
`)+` plus
`≢⍟` the length-logarithm of
`1⊥` the sum (lit. the base-one evaluation) of
`≢` the length
`*` raised to the power of (each element in)
`⊢` the argument
### Old solution: [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 22 bytes
Anonymous prefix lambda.
```
{0::1+⊃⍵⋄+/⍢((≢⍵)∘*)⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/v9rAyspQ@1FX86PerY@6W7T1H/Uu0tB41LkIyNd81DFDSxPIqP2f9qhtwqPePrC6NY96txxab/yobeKjvqnBQc5AMsTDM/h/mgJQjitNQcfQ1BxIGekYAUlDHSMdYzBtDIQgcROwuLGOoY4JkDbQAUOQiJ6hiY6ukZ65oQUA "APL (Dyalog Extended) – Try It Online")
`{`…`}` "dfn"; argument is `⍵`
 `0::` if any error happens:
  `1+` increment
  `⊃⍵` the first element of the argument
 `+/⍢(`…`)⍵` the sum of the argument, under the influence of:
  `(`…`)∘*` raising to the power of:
   `≢⍵` the tally of elements (length of the argument)
[Answer]
# JavaScript (ES7), 62 bytes
```
a=>a.map(v=>t+=n**v,t=0,n=a.length)&&(L=Math.log)(t)/L(n)||++a
```
[Try it online!](https://tio.run/##ZdBLDsIgEIDhvadwZcBOp4VBqQs8gZ7AuCDa@kiljZKujFevVhOthVnyZf7A2Tb2trueah@7ap@3hWmtWVq82Jo1Zukj46bTBrxJwRmLZe4O/sgnE7Yya@uPWFYHzjxPVszx@z2KbLur3K0q8@6GFWyz5XzcO0kyFqMBETPdVx2ZZUMkQQ4QBXtAAv3QizwIiZQOIb3mG@2gxjQNoyqIPhSSFIshJBCg/tMKZTYPNqbwnl46@A5CoSCWqEXWsc8zxFzp9gk "JavaScript (Node.js) – Try It Online")
### How?
Given the input list \$a\$ and its length \$n\$, we compute:
$$t=\sum\_{i=0}^{n-1}n^{a\_i}$$
We then try to compute \$log\_n(t)=log(t)/log(n)\$.
If the result is `NaN`, we return `++a` instead.
This will happen if:
* \$n=0\$ : we try to compute \$\log(0)/\log(0)\$
* \$n=1\$ : we try to compute \$\log(1)/\log(1) = 0/0\$
This gives the correct answer in both cases because:
* if \$n=0\$, we increment the empty array, which gives \$1\$.
* if \$n=1\$, there's a single atom \$x\$ in \$a\$ which is coerced to a number and incremented.
[Answer]
# [Haskell](https://www.haskell.org/), 54 bytes
```
f[]=1
f[x]=1+x
f x|n<-sum$1<$x=logBase n$sum$map(n**)x
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/Py061taQKy26AkhpV3ClKVTU5NnoFpfmqhjaqFTY5uSnOyUWpyrkqYCEchMLNPK0tDQr/ucmZubZFhRl5pWopEUb6xjH/gcA "Haskell – Try It Online")
# [Haskell](https://www.haskell.org/), 56 bytes
```
f[]=1
f[x]=1+x
f x|n<-sum$x>>[1]=logBase n$sum$map(n**)x
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/Py061taQKy26AkhpV3ClKVTU5NnoFpfmqlTY2UUbxtrm5Kc7JRanKuSpgARzEws08rS0NCv@5yZm5tkWFGXmlaikRRvrGMf@BwA "Haskell – Try It Online")
# [Haskell](https://www.haskell.org/), 70 bytes
```
f[]=1;f[x]=1+x;f x|let n=fromIntegral$length x=logBase n$sum$map(n**)x
```
[Try it online!](https://tio.run/##DcU7DoAgDADQqzAw@FuMo2Fx8wzEoUOLxlINYNLBu6NveTvkE5lrJb@5cSavf73OZPRlLEYcpSuuUjAkYMsooexGHV9hgYxGbH6ijXA30nWt1giHuDsdUiz5aZi2@gE "Haskell – Try It Online")
[Answer]
# [Python](https://www.python.org) NumPy, 81 bytes
```
lambda l:[sum(l)+1,w(l*(x:=w(l*0)))/x][x>0]
from numpy import*
w=logaddexp.reduce
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NZFNjptAEIWV5XAKxAommHT9dHe1JfsOkbJzvGDGOIOEDcIwts8ym5Gi5C45QnKaFNijRmqq6P7ee8Xb7-46vLTH95_71fdf47BfyN-vTXl42pVxs9ycxkPaZJ8hP6fNY3pZrqbdZFn25bLdXNZmG-379hAfx0N3jetD1_bDY3ReNe2PcrerLl3RV7vxubqDT-eXuqnib_1YLaOHJl7F9bEbhzSLHtI6bzNtNMWpa-ohTRbrRNu1tqrXsklrLdqPolVs15TPVZoURZHkSZLp566vj8PEyfdp2fflVS9l2U36_d-nP5ttvFjHEG3A-turlWiDOc4FaT_HnG5FQcQevIXAHn1AF4h8cAbZeGS2KBysOPDO6aYtISB2TAGRwXNQXxOQdN3EfGGM9SJkVVaMiLVGD0uwbAlEBC1NTCYbrEUHLhgODgGYPRvn_Izku10uCCGgmMAinhyqX_GG1DBqK1Awal_cbCyQGrdiHKCx7K0jFZpxlEPOdyBqkBAABUHQa8Ipple2U65BC85P6fWEd540owsM6h2Z9CE7A00-r49RUwGcL7DwIPfBgmOnc1P3EERpU3LRkQFb5YuEKZU1BhG9cUKaDsjoCWbVE6cqt1_6Hw)
Takes a numpy array for input.
Test harness nicked from @AnttiP.
#### How?
Uses the almost-builtin: `numpy.logaddexp.reduce` Shame it's such a mouthful.
[Answer]
# [R](https://www.r-project.org), ~~50~~ 44 bytes
*Edit: -1 byte thanks to [@Dominic van Essen](https://codegolf.stackexchange.com/users/95126/dominic-van-essen).*
```
\(x,`?`=sum,l=?x|1)`if`(l<2,x?1,log(?l^x,l))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=VZJdSitBEIXx1VUE7ssMdIb6_wFjNiISECLCiKA3kIe7k_sSBRelm9GaxCRIDzRzqD6nvur-__q8e1sv3jd_1_P4aDfdtq2Wq8XL5rGNi-X2H_arh_WqG6-obZfYxqf7bjnebtvY94cznxdf6-6u6_vZn9n8eoaX0x-qnwSNvUSNjhIfaho1PkkDszi6YoqTJ1kyexqQgJOIUkhqGLpZbSUFI4sJJ5GgSw7D8GPLtU7xPgCoR7BWIwERqlBHIlWUMSJIeXIW1lQlQ0uQNEIUcQEzPxrLGUAGJkwKSIlwNqrew4GreSopOaFQwvZNJheEBhgSqLgaV9zRlBs2OdtSoWUiBWGQF_ME7pVg5Q6kaD7NoyrcnIvaUrA4SLg-1qMttP36fSk8oLQ5DY5xHjuaWE21eDCjnKeJRA0URSsrIidOBSAiBwsuXmSoCpHKDqvEwzvY7Q77Nw)
[Answer]
# Excel, 57 bytes
```
=LET(x,A1#,y,ROWS(x),IF(y-1,LOG(SUM(y^x),y),IFNA(x+1,1)))
```
Input is vertical spilled range `A1#`.
[Answer]
# [Python](https://www.python.org) NumPy, 70 bytes
```
lambda l:math.log(sum(L**l),L)if(L:=len(l))>1else sum(l)+1
import math
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NVFLjptAEFWWwykQK5hg1PXp7mpL9jIrL7NzsmASHCM1BmE8I58hR8hmpCi5S46QnCYF9qiRoF5Vv0_x4_dwnY796fXnYfPp12U6rOTvh1h3T1_rNK67ejpWsf-Wny9dvnt8jEW5K9pDvltvYnPKY1FsoYnnJp37sXgPSdsN_Til88U72_fD2Hfp6dIN1_TercexviYvxzY26cfx0qyTh5hu0vY0XKa8SB7ytuwLBWJ1HmI75dlqmyncKtQ81zFvtejfir4amyHWX5o8q6oqK7Os0PYwtqdp5ikP-SKnl4riZun137s_-8_paptCsgfrb59Wkj2WuBSkeIkl3YqKiD14C4E9-oAuEPngDLLxyGxROFhx4J3Tl0JCQOyYAiKD56C-ZkLScxPzlTHWi5BVWTEi1hodlmDZEogIWpo5mWywFh24YDg4BGD2bJzzCyXf7XJFCAHFBBbx5FD9ijekhlGhQMGofXGLsUBq3IpxgMayt45UaKGjEkq-E6IGCQFQEAS9JpxjeuV2ymvQgvNzep3wzpNmdIFBvSOTPmQXQlMu523VVAGXK6w8yH2x4Njp3tQ9BFG2ObnoyoCt8ouEOZU1BhG9cUKaDsjoBLPqiVOV2y_9Dw)
A rather dirty mix which expects a numpy array as input to take advantage of vectorised arithmetic but later uses the log from std lib math because it allows to specify the base.
Test harness from @AnttiP via @loopywalt.
[Answer]
# [Python](https://www.python.org), 85 76 bytes
Essentially by @Albert.Lang
```
lambda l:math.log(sum(map(pow,[L:=len(l[2:])+2]*L,l+l+[0,0])),L)
import math
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NVDLbtswEESP0VcIOpE1TZDLxy4NOF_gY26qD0or1wIoS3DkBPmWXgIUyT-lX9OV5WAvnOHOzO7--Rhfp-Nwevt72P54v0yHNX3uctM__mrKvOmb6ajz8Fs8XXrRN6MYhxdV7zbb3J5ErmGzlyvYf9-pvMqr2iizl1LtZNH143Ceyll-88wvxy635cP50m6Ku1xuy-40XiYhizvRqUEykfXTmLtJVOv7iumOqfa5yaJjMHyBQZ_bMTc_W1FprStVVZK_x3N3mmYfdeB2uWS-_fsm6325vi9tUduAyzNQUYOCK3DMK1BuAdo5jxaDTR4BE8TkHKZowBsE7wNw4CxwXIsZamMCErnAtmSIQjAJgFLwwVkiWiT-Fue1A5uATPJE6CJwHqFxHAhMJZeu7U5Z5W8CoIgpWSCwBAg0j0HI2sg6A-Eq4LvP9bWq09arNWi0dFvMRh-jRU63iRDSPBl5i9aHiDwLuywn-w8)
[Answer]
# [Go](https://go.dev), 160 bytes
```
import."math"
type F=float32
func f(N[]F)F{L,s:=F(len(N)),0.0
if L<1{return 1}
if L<2{return N[0]+1}
for i:=0;i<int(L);i++{s+=Pow(L,N[i])}
return Log(s)/Log(L)}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XZHNasMwDMfZ1ac9ggkUbKJm-dpa2mbHnEzoPQsjlLgza5ySOB0j5El2CYM9xB5lfZo5acuWooOsnyzxl_TxuS267326eU23Gc5TIZHI90WpLIPnyviqFZ_Of7oLy1P1YiD1vs9wGPBdkSrPRbyWG8xJFCchDRsG1SIIyS6TJKIUbMtGgmO2cpoyU3UpsdOegHsBUWwnpqa8KLFYBPZSrIRUhNGlMM2mMoN18UYYRLFIaIvORazYkore9Y7R9qTzeHM7aOnHIBQ3SNY5E5XCiwDHSZwMgh_8Bv09W_gXOPezUeyCO86DC94V8bSNq_yrKg8c8EfEhsHGvyzHh6lrzZy55i0atvEMeoKql1-mUt_nMk-D1qVeESfG5ICDRzw5PEkD-nQF-hK9p7Rvcl5M1538Lw)
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~57~~ 53 bytes
```
->x{k=x.size;k>1?Math::log(x.sum{|c|k**c},k):x.sum+1}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf166iOtu2Qq84syrVOtvO0N43sSTDyionP10DKFiaW12TXJOtpZVcq5OtaQUW0Tas/V@gkBYdHRvLBaYNTc1hTCMdI7iojpGOcWzsfwA "Ruby – Try It Online")
[Answer]
# Vyxal, 24 Bytes
```
□L2<[?1+,]□L:ẋ□e∑∆l□L∆l/
```
### My first Vyxal answer!
[Try it online! (List is given as input of numbers separated by newlines. This will not work if there is a trailing or leading newline in the input.)](https://vyxal.pythonanywhere.com/?v=2#WyIiLCIiLCLilqFMMjxbPzErLF3ilqFMOuG6i%20KWoWXiiJHiiIZs4pahTOKIhmwvIiwiIiwiMy4xNFxuMi43MTgiXQ==)
If you want the output as a decimal instead of a fraction, use the `ḋ` flag.
If the length is `2` or above, it applies the general formula and implicitly prints the result. If the length is `1` or `0`, it adds `1` to the number. With a list of length `1`, this just increments the number and prints it. With a list of length `0`, it increments it to get `1` and prints it, but then throws an error. Luckily, `STDERR` is ignored by default.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 27 bytes
```
Ｉ⎇Φθκ▷math.log⟦ΣＸＬθθＬθ⟧⊕↨θ¹
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iOSOxKDk_MWfBgqWlJWm6FjcrAooy80o0nBOLSzRCUovyEosqNdwyc0pSizQKdRSyNXUUXMsSc8ISizSUchNLMvRy8tOVdBSig0tzNQLyy4GqfFLz0ksyNAqBKgs1gQScHwvkeOYlF6XmpuaVpKZoOCUWp4LMNNAEAeslxUnJxVBXLI9W0i3LUYpdER1tpKNgFBsLEQYA)\*\* Link is to verbose version of code. Explanation: Port of @AnttiP's Python answer.
```
   θ                        Input array
  Φ                         Filtered where
    κ                       Index is not zero
 ⎇                          If still not empty then
                  θ         Input array
                 Ｌ          Length
                Ｘ           Vectorised raise to power
                   θ        Input array
               Σ            Summed
     ▷math.log⟦       ⟧     Logarithm to base
                     θ      Input array
                    Ｌ       Length
                         θ  Otherwise input array
                        ↨ ¹ Summed via "base 1" conversion*
                       ⊕    Incremented
Ｉ                           Cast to string
                            Implicitly print
```
\*Base 1 conversion returns `0` for an empty list, which `Sum` does not.  
\*\*I'm using ATO instead of TIO because the version of Charcoal on TIO incorrectly prints floats whose value is just below that of an integer.
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 48 bytes
```
x->if(1<n=#x,log(vecsum(n^x))/log(n),n,x[1]+1,1)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=LU3dCoIwFH6VYTcbnZlnGnqRvoiskGgi2BqmsZ6lGyGiZ-pt2qZ8cL4_Ps7ra5qhO7VmfitSfqZR8eKXWF51iuJBlxsL_a2lj8v5Pl2pPlrGdj7QDDTYGuUWAdm6Gxpj-ie1hFfEDJ0enYy8iYiibgmkrqU7uM89CRDBgYB0EalDqLKlSgEh8yKBgJDFmAEXcY6FlOvneV74Dw)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~17~~ 15 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
g©ImO®.n®_+®i+`
```
[Try it online](https://tio.run/##yy9OTMpM/f8//dBKz1z/Q@v08g6ti9c@tC5TO@H//2gTHaNYAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfaXL//RDKytz/Q@t08s7tC5e@9C6TO2E/7U6/6OjY3WiDU3NgaSRjhGIrWOkYwymjYEQJG4CFjfWMdQxAdIGOmAIEtEzNNHRNdIzN7SIjQUA).
**Explanation:**
```
g©ImO®.n  # Otherwise portion of the formula:
g         #  Push the length of the (implicit) input-list
 ©        #  Store it in variable `®` (without popping)
  I       #  Push the input-list
   m      #  Take the length to the power of each element
    O     #  Sum them together
     ®.n  #  Take the base-`®` logarithm of that sum
®_+       # n=0 case of the formula:
®_        #  Push length `®` again, and check whether it's 0 (1 if 0; 0 otherwise)
  +       #  Add that to the value
®i+`      # n=1 case of the formula:
®i        #  If length `®` is 1:
  +       #   Add the current value to the wrapped value of the input-list
   `      #   And unwrap it by popping and pushing its value to the stack
          # (after which the result is output implicitly)
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 15 bytes
```
.x.ls^lQQlQhe+Z
```
[Try it online!](https://tio.run/##K6gsyfj/X69CL6c4LicwMCcwI1U76v//aEMdYyA0jwUA "Pyth – Try It Online")
### Explanation
```
.x.ls^lQQlQhe+ZQ    # implicitly add Q
                    # implicitly assign Q = eval(input())
.x                  # try:
     ^lQQ           #   length(Q) to the power of each element of Q
    s               #   sum all elements
  .l     lQ         #   take the log base length Q
                    # except: (log will error if length is 0 or 1)
             +ZQ    #   prepend 0 to Q
            e       #   take the last element
           h        #   and increment it
```
[Answer]
# [Desmos](https://desmos.com/calculator), 68 67 ~~65~~ 53 Bytes
Thanks to [AidenChow](https://codegolf.stackexchange.com/users/96039/aiden-chow%5D) for -12 Bytes!
```
l=a.length
f(a)=\{l=0,l=1:a[1]+1,\log_l(l^a.\total)\}
```
Now needs a keypress before it works  
Without needing keypress (and visible) (~~66~~ 65 Bytes):  
-1 from AidenChow
```
f(a)=\left\{l=0,l=1:a[1]+1,log_l(l^a.total)\right\}withl=a.length
```
[Link](https://www.desmos.com/calculator/vwkm9hv9cg)
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 105 bytes
```
[H|T]*L*S:-T*L*N,S is N+L^H,!.
_*0.
A-K:-A=[B],K is B+1,!;length(A,L),L>1,A*L*S,K is log(S)/log(L),!;K=1.
```
[Try it online!](https://tio.run/##JYxNC4JAGITv/oq8rTq7tWoUisF2EpQuehC2LQikBD/Cgi79d9vdGHifYeZlnvPUT3f6@nTLIvNvrfzSrxJaa5xQrbrX6hSUlxwuc67@hjmCFgkVmTwqFKY9Bhxu2rfj/f0gAqWH8sAhzMr/Qa@Tylsb6NJNi4yzxU5IBcm3O31DhMYjRGQZaZk8tnkEjlhzAyuTMB6DhmzH90phaIdbO5MGwkNDa5yDz9y9234ktceWHw "Prolog (SWI) – Try It Online")
Defines a predicate `A-K` which matches the ordered list `A` to its logarithmic incrementation `K`.
[Answer]
# [Scala](https://www.scala-lang.org/), 95 bytes
Golfed version. [Try it online!](https://tio.run/##JU5Nb8IwDL33V/gYayiAditKJaQdYRfECaEqdGnJ5CZdEj6r/vbiDh@s9yH7vVhp0qNtOx8SxInIVqezLLPMn35NlWCrrYM@u2qCOt/YmA5f/nIic1TFG4AaSRUEfFed@0pHA9@WlSX84535E3dk@nF/C6Uq@umbUySjfZoV@UYQx3ai8zfhZiWijJcW55PhcBhGgB9Tc4B1Qocm5rAOQT8OuxSsa46Yw97ZBIprAk/HaiInajHVFZ9yMQNeiMj2kA3jCw)
```
l=>l match{case Nil=>1 case Seq(x)=>1+x case _=>{val n=l.size;log(l.map(pow(n,_)).sum)/log(n)}}
```
Ungolfed version. [Try it online!](https://tio.run/##TU9BasMwELzrFXOUaFBSejOkUMix6aX0FIpRVNlRWUtGktuU4re7shqHXJbdmWF2JmpFapps1/uQEOdLdiqdZM2YP34anbBX1uGXAR@mQcOpwrON6bDzw5HMu6jwv2FbRAAhG@jT5QK0igYvlrB9xL3c3KKzET@LwuAO51uuntHFA/hSBJd/kNR@cIkXOoXBiKuEfMspp@9577@5W6EWQsahE1gXzi3SkS1zZJdeXS7JVWhjhacQ1M/hNQXr2rnem7PpWq7PaCLHG16yP8jNCnkIIYrbyKbpDw)
```
import scala.math._
object Main {
  def f(l: List[Double]): Double = {
    l match {
      case Nil => 1.0
      case List(x) => 1 + x
      case _ => {
        val n = l.count(_ => true)
        log(l.map(pow(n, _)).sum) / log(n)
      }
    }
  }
  def main(args: Array[String]): Unit = {
    println(f(List(3.0, 3.0)))
  }
}
```
[Answer]
# [Perl 5](https://www.perl.org/) List::Util, 43 bytes
```
sub{@_>1?log(sum map@_**$_,@_)/log@_:1+pop}
```
[Try it online!](https://tio.run/##VZBRT4MwFIWf5VfckE222SG3LbRAtvGucS/6pIaogYXIBg5INMt@O7YDlo2@0HO@cy7cMtnnbttUCTxmVR0EL3WWg1U1Wys0tn8wShdt1XweoniJq7zYTJQD248yimezUUyieHqv1CgO8K4symMbGmmxBx3MVR1MDIBXuH7wnWgVXXGWFktAV3Y6JfRSZz1NKGEXqs0YFyhc9Lmgwh8gpo4YIGE7jiukZK4ql04P8et@bjOKPlU2l1Iwr4MYQcIvISo94ftIJUVJRQc55HTOf9BHbeRkTm2BsvtS9LjnoVBj0Jc6Oj0YOqKXlPyWyVddwQLU9qLTzsKzuSlqZdyO0knnTDur3Ge7OjXHc68CyHZlUwcwniNVN@j7tEAdLagOdanediYxbkxdaULyA@Yw2YQVWMW3BQFYT@tnWD9YGuwG6swA6leVDo1j@w8 "Perl 5 – Try It Online")
]