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 664 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 9 bytes

ÆEz0Ṣ€ZÆẸ

Try it online!

How it works

ÆEz0Ṣ€ZÆẸ Main link. Argument: A (array)
ÆE For each n in A, compute the exponents of n's prime factorization.
 E.g., 2000000 = 273056 gets mapped to [7, 0, 6].
 z0 Zip 0; append 0's to shorter exponent arrays to pad them to the same
 length, then read the resulting matrix by columns.
 Ṣ€ Sort the resulting arrays (exponents that correspond to the same prime).
 Z Zip; read the resulting matrix by columns, re-grouping the exponents by
 the integers they represent.
 ÆẸ Unexponents; map the exponent arrays back to integers.

Jelly, 9 bytes

ÆEz0Ṣ€ZÆẸ

Try it online!

Jelly, 9 bytes

ÆEz0Ṣ€ZÆẸ

Try it online!

How it works

ÆEz0Ṣ€ZÆẸ Main link. Argument: A (array)
ÆE For each n in A, compute the exponents of n's prime factorization.
 E.g., 2000000 = 273056 gets mapped to [7, 0, 6].
 z0 Zip 0; append 0's to shorter exponent arrays to pad them to the same
 length, then read the resulting matrix by columns.
 Ṣ€ Sort the resulting arrays (exponents that correspond to the same prime).
 Z Zip; read the resulting matrix by columns, re-grouping the exponents by
 the integers they represent.
 ÆẸ Unexponents; map the exponent arrays back to integers.
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Jelly, 9 bytes

ÆEz0Ṣ€ZÆẸ

Try it online!

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