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 Answer

Commonmark migration
Source Link

#05AB1E , (削除) 26 (削除ここまで)(削除) 24 (削除ここまで) 23 bytes

05AB1E , (削除) 26 (削除ここまで)(削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power of this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take the square of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)

#05AB1E , (削除) 26 (削除ここまで)(削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power of this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take the square of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)

05AB1E , (削除) 26 (削除ここまで)(削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power of this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take the square of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
deleted 1 character in body
Source Link
Grimmy
  • 15.8k
  • 1
  • 36
  • 64

#05AB1E, (削除) 26 (削除ここまで) (削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power of this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take 2 to the powersquare of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)

#05AB1E, (削除) 26 (削除ここまで) (削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take 2 to the power of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)

#05AB1E, (削除) 26 (削除ここまで) (削除) 24 (削除ここまで) 23 bytes

Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Explanation:

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power of this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take the square of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
added 276 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Δ©P®gzm®ÅA®zÅAz®nÅAtΔ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # GeometricArithmetic mean:
 P ÅA # Take theBuiltin productto ofcalculate the list
  ®g # arithmetic mean Pushof the list from `®` again, and get its length
 z # # CalculateGeometric 1/lengthmean:
 ®.2 m # And thenTake takethe thisbase-2 calculatedlogarithm productof toeach thevalue powerin ofthe thislist 1/length`®`
 ÅA # (NOTE:Get a^(1/4)the isarithmetic themean sameof asthat 4√a)list
 o # Arithmetic mean:
 ®ÅA  # And take Builtin2 to calculate the arithmetic mean ofpower listthis `®`mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take 2 to the power of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And then take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

-1 byte thanks to @Grimy.

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

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Geometric mean:
 P # Take the product of the list
  ®g #  Push the list from `®` again, and get its length
 z # Calculate 1/length
 m # And then take this calculated product to the power of this 1/length
 # (NOTE: a^(1/4) is the same as 4√a)
 # Arithmetic mean:
 ®ÅA  #  Builtin to calculate the arithmetic mean of list `®`
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take 2 to the power of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And then take the square-root of that
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
Δ©ÅA®.2ÅAo®zÅAz®nÅAt)}н

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

-1 byte thanks to @Grimy.

23 byter alternative for Geometric mean:

Δ©P®gzm®ÅA®zÅAz®nÅAt)}н

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

Δ # Loop until the list no longer changes:
 © # Store the current list in variable `®` (without popping)
 # (which is the implicit input-list in the first iteration)
 # Arithmetic mean:
 ÅA # Builtin to calculate the arithmetic mean of the list
 # Geometric mean:
 ®.2 # Take the base-2 logarithm of each value in the list `®`
 ÅA # Get the arithmetic mean of that list
 o # And take 2 to the power this mean
 # Harmonic mean:
 ®z # Get 1/x for each value x in the list `®`
 ÅA # Get the arithmetic mean of that list
 z # And calculate 1/y for this mean y
 # Quadratic mean:
 ®n # Take 2 to the power of each number x in the list from the register
 ÅA # Calculate the arithmetic mean of this list
 t # And take the square-root of that mean
 ) # Wrap all four results into a list
}н # After the list no longer changes: pop and push its first value
 # (which is output implicitly as result)
Forgot to update the actual code I now noticed..
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
added 14 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
added 259 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
deleted 38 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading

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