Skip to main content
added a variant using Table
Source Link
Syed
  • 59.5k
  • 5
  • 40
  • 95

For versions prior to v13.1:

g = Map[Apply[Sequence]]@*Map[Apply[ConstantArray]]@*FactorInteger

or

h = Flatten@*Map[Apply[Table]]@*FactorInteger;

Example:

g /@ Range[100, 600, 50]

{{2, 2, 5, 5}, {2, 3, 5, 5}, {2, 2, 2, 5, 5}, {2, 5, 5, 5}, {2, 2, 3, 5, 5}, {2, 5, 5, 7}, {2, 2, 2, 2, 5, 5}, {2, 3, 3, 5, 5}, {2, 2, 5,
5, 5}, {2, 5, 5, 11}, {2, 2, 2, 3, 5, 5}}

For versions prior to v13.1:

g = Map[Apply[Sequence]]@*Map[Apply[ConstantArray]]@*FactorInteger

Example:

g /@ Range[100, 600, 50]

{{2, 2, 5, 5}, {2, 3, 5, 5}, {2, 2, 2, 5, 5}, {2, 5, 5, 5}, {2, 2, 3, 5, 5}, {2, 5, 5, 7}, {2, 2, 2, 2, 5, 5}, {2, 3, 3, 5, 5}, {2, 2, 5,
5, 5}, {2, 5, 5, 11}, {2, 2, 2, 3, 5, 5}}

For versions prior to v13.1:

g = Map[Apply[Sequence]]@*Map[Apply[ConstantArray]]@*FactorInteger

or

h = Flatten@*Map[Apply[Table]]@*FactorInteger;

Example:

g /@ Range[100, 600, 50]

{{2, 2, 5, 5}, {2, 3, 5, 5}, {2, 2, 2, 5, 5}, {2, 5, 5, 5}, {2, 2, 3, 5, 5}, {2, 5, 5, 7}, {2, 2, 2, 2, 5, 5}, {2, 3, 3, 5, 5}, {2, 2, 5,
5, 5}, {2, 5, 5, 11}, {2, 2, 2, 3, 5, 5}}

Source Link
Syed
  • 59.5k
  • 5
  • 40
  • 95

For versions prior to v13.1:

g = Map[Apply[Sequence]]@*Map[Apply[ConstantArray]]@*FactorInteger

Example:

g /@ Range[100, 600, 50]

{{2, 2, 5, 5}, {2, 3, 5, 5}, {2, 2, 2, 5, 5}, {2, 5, 5, 5}, {2, 2, 3, 5, 5}, {2, 5, 5, 7}, {2, 2, 2, 2, 5, 5}, {2, 3, 3, 5, 5}, {2, 2, 5,
5, 5}, {2, 5, 5, 11}, {2, 2, 2, 3, 5, 5}}