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, 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.
f({n,n,...,n})=n+1
no matter how long the list is \$\endgroup\$