Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

1 of 8
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#05AB1E (legacy), 26 bytes

Δ©OY/®PYzmY®zO/®nOY/t)4V}н

Try it online or see the steps of all test cases.

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in the register (without popping)
 # (which is the implicit input-list in the first iteration)
 O # Take the sum of the list
 Y/ # Divided by `Y` (`Y` is 2 by default)
 ®P # Take the product of the list
 Yz # And 1/`Y`
 m # Then take the result of the product to the power of 1/`Y`
 # (NOTE: a^(1/4) is the same as 4√a)
 ®z # Get 1/x for each value x in the list
 O # Take the sum of that
 Y / # And then divide `Y` by that sum
 ®n # Take 2 to the power of each number x in the list
 O # Take the sum of that
 Y/ # Divide it by `Y`
 t # And then take the square-root of that
 ) # Wrap all four results into a list
 4V # And set variable `Y` now to 4 instead of 2
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

AltStyle によって変換されたページ (->オリジナル) /