Re: FactorInteger Print Formatting
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg795] Re: FactorInteger Print Formatting
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Wed, 19 Apr 1995 00:46:33 -0400
Here is a variant of Dave Wagner's [mg719] solution to AlanPowell's problem: >>Could anyone suggest a neat way to reformat the output of >>FactorInteger into a more usable print format? >< details deleted > It uses Block to temporarily hold evaluation; a trick that is quite often useful. In[1]:= lst = FactorInteger[238500] Out[1]= {{2, 2}, {3, 2}, {5, 3}, {53, 1}} In[2]:= Block[{Times,Power},HoldForm@@{Times@@Apply[Power, lst,{1}]}] Out[2]= 2 2 3 1 2 3 5 53 In[3]:= FullForm[%] Out[3]//FullForm= HoldForm[Times[Power[2, 2], Power[3, 2], Power[5, 3], Power[53, 1]]] Module does not work In[4]:= Module[{Times,Power},HoldForm@@{Times@@Apply[Power,lst,{1}]}] Out[4]= Times$1[Power$1[2, 2], Power$1[3, 2], Power$1[5, 3], Power$1[53, 1]] Allan Hayes hay at haystack.demon.co.ok