Suppose I have:

Do[Print[i/i!], {i, 1, 10}]

I would like the output to be like:

1/1!, 2/2!, 3/3! , ...,10/10!

However, when I use the code above the factorial evaluates by Mathematica. I tried to enclose the factorial part by TraditionalForm or Unevaluated but it didn't help.

How can I get the form I like as above?

  • 3
    $\begingroup$ There are many similar questions. Search for HoldForm: #/HoldForm[#!] & /@ Range[10] $\endgroup$ – Kuba Jan 29 '15 at 13:21
  • $\begingroup$ It seems inside a loop HoldForm doesn't work. $\endgroup$ – MOON Jan 29 '15 at 13:27
  • 1
    $\begingroup$ Use With to inject i. Or Inactivate[Factorial][i] or #/HoldForm[#!] &[i] inside the loop.; $\endgroup$ – Kuba Jan 29 '15 at 13:29

Utilizing the suggestion of @Kuba With:)

Like this:

   With[{j = i}, HoldForm[j/j!]]], {i, 1, 10}]


  With[{j = i}, HoldForm[j/j!]], {i, 1, 10}]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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