I am trying to illustrate some simple ideas with exponents. I can manually express something like $5^4$ as $5 \cdot 5 \cdot 5 \cdot 5$, but wondered how to get Mathematica to do that for me.

I found the example below in the documentation, but can't figure out how to "massage" it to work with a number that only has one factor, for example I would like $625$ to be represented as $5 \cdot 5 \cdot 5 \cdot 5$:

CenterDot @@ (Superscript @@@ FactorInteger[20!])

Any ideas would be appreciated.

  • 1
    $\begingroup$ For several years now there has also been the InactiveFactorInteger ResourceFunction, though it does not expand non-distinct factors like you want, e.g. ResourceFunction["InactiveFactorInteger"][12] returns $2^2\times3$ . $\endgroup$
    – user170231
    Jun 8, 2023 at 17:18

2 Answers 2


Here's a way that seems to work:

CenterDot @@ Flatten[ConstantArray @@@ FactorInteger[20!]]

enter image description here

CenterDot @@ Flatten[ConstantArray @@@ FactorInteger[625]]

enter image description here

To get the number back, merely do

Times @@ expr

where expr is the name for the expression that results from the code above.


You can also make use of Inactive to allow you to calculate the value later.

Starting with march's solution and altering the Apply.

n = 20!;
t = Inactive[Times] @@ Flatten[ConstantArray @@@ FactorInteger[n]]
(* 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*3*3*3*3*3*3*3*3*5*5*5*5*7*7*11*13*17*19 *)

t can be Activated to calculate the value.

Activate@t == n
(* True *)

Hope this helps


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.