Skip to main content
Commonmark migration
Source Link

#05AB1E, 11 9 11 7 bytes

05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)

#05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)

05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)
Verified and added latest test case which cause floating point errors in some other answers (but no problems here)
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test casesverify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)

#05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)

#05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

.²       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)
added 375 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 11 99 11 7 bytes

εć.²š}P`›²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [[a1,a2,a3][a1,[b1b1], [a3,b2b3], [a2,b3]]b2] as three separated inputs.

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

ε       # Take the #logarithm Mapwith base 2 of the (implicit) input[a1,b1]-lists to:input
 ć   Š      # Triple-swap Extracta,b,c theto head;c,a,b pushingwith the remainder and head separated to theimplicit stackinputs
         #  Get theThe logarithmstack withorder baseis 2now: of[log2(a1),log2(b1)], this[a2,b2], head[a3,b3]
    š m     #  And prependTake itthe backpower, toresulting thein remainder[a2**a3,b2**b3]
     }P*    # After theMultiply map:it takewith the product of bothlog2-list, mappedresulting innerin lists[log2(a1)*a2**a3,log2(b1)*b2**b3]
       `   # Push both integersvalues separated to the stack
        ›  # And check if Alog2(a1)*a2**a3 is larger than Blog2(b1)*b2**b3
         # (after which the result is output implicitly)

#05AB1E, 11 9 bytes

εć.²š}P`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna

Input as [[a1,a2,a3],[b1,b2,b3]].

Try it online or verify all test cases.

Explanation:

ε          # Map the (implicit) input-lists to:
 ć         #  Extract the head; pushing the remainder and head separated to the stack
         #  Get the logarithm with base 2 of this head
    š      #  And prepend it back to the remainder
     }P    # After the map: take the product of both mapped inner lists
       `   # Push both integers separated to the stack
        ›  # And check if A is larger than B

#05AB1E, 11 9 11 7 bytes

.²Šm*`›

Port of @Arnauld's JavaScript and @digEmAll's R approaches (I saw them post around the same time)
-2 bytes thanks to @Emigna
+2 bytes as bug-fix after @Arnauld's and @digEmAll's answers contained an error
-4 bytes now that a different input order is allowed after @LuisMendo's comments

Input as [a1,b1], [a3,b3], [a2,b2] as three separated inputs.

Try it online or verify all test cases.

Explanation:

       # Take the logarithm with base 2 of the implicit [a1,b1]-input
  Š      # Triple-swap a,b,c to c,a,b with the implicit inputs
         #  The stack order is now: [log2(a1),log2(b1)], [a2,b2], [a3,b3]
   m     # Take the power, resulting in [a2**a3,b2**b3]
    *    # Multiply it with the log2-list, resulting in [log2(a1)*a2**a3,log2(b1)*b2**b3]
     `   # Push both values separated to the stack
      ›  # And check if log2(a1)*a2**a3 is larger than log2(b1)*b2**b3
         # (after which the result is output implicitly)
added 212 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
deleted 213 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading