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

added 121 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

J, 17 bytes

/:~"1&.|:&.(_&q:)

Try it online!

Probably the first J answer on PPCG to use &. twice. After this and that , I'm starting to feel like a weird J hacker.

Basically a translation from Dennis' Jelly answer.

How it works

/:~"1&.|:&.(_&q:) Single monadic verb.
 (_&q:) Convert each number to prime exponents
 (automatically zero-filled to the right)
 |:&. Transpose
/:~"1&. Sort each row in increasing order
 |:&. Transpose again (inverse of transpose == transpose)
 (_&q:) Apply inverse of prime exponents; convert back to integers

J, 17 bytes

/:~"1&.|:&.(_&q:)

Try it online!

Probably the first J answer on PPCG to use &. twice. Basically a translation from Dennis' Jelly answer.

How it works

/:~"1&.|:&.(_&q:) Single monadic verb.
 (_&q:) Convert each number to prime exponents
 (automatically zero-filled to the right)
 |:&. Transpose
/:~"1&. Sort each row in increasing order
 |:&. Transpose again (inverse of transpose == transpose)
 (_&q:) Apply inverse of prime exponents; convert back to integers

J, 17 bytes

/:~"1&.|:&.(_&q:)

Try it online!

Probably the first J answer on PPCG to use &. twice. After this and that , I'm starting to feel like a weird J hacker.

Basically a translation from Dennis' Jelly answer.

How it works

/:~"1&.|:&.(_&q:) Single monadic verb.
 (_&q:) Convert each number to prime exponents
 (automatically zero-filled to the right)
 |:&. Transpose
/:~"1&. Sort each row in increasing order
 |:&. Transpose again (inverse of transpose == transpose)
 (_&q:) Apply inverse of prime exponents; convert back to integers
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

J, 17 bytes

/:~"1&.|:&.(_&q:)

Try it online!

Probably the first J answer on PPCG to use &. twice. Basically a translation from Dennis' Jelly answer.

How it works

/:~"1&.|:&.(_&q:) Single monadic verb.
 (_&q:) Convert each number to prime exponents
 (automatically zero-filled to the right)
 |:&. Transpose
/:~"1&. Sort each row in increasing order
 |:&. Transpose again (inverse of transpose == transpose)
 (_&q:) Apply inverse of prime exponents; convert back to integers

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