MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Writing prime factor decomposision in conventional form

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65324] Re: Writing prime factor decomposision in conventional form
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 27 Mar 2006 06:55:50 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <e05ri1$3ru$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Dr. Wolfgang Hintze wrote:
> How can I get a conventional form output for the prime number 
> decomposition, e.g. {{2,3},{5,1}} as 2^3 5 ?
> 
> I have found some (rather cumbersome) method but it leaves the final 
> expression in "" when I put it into input format in order to transfer it 
> in simple text form to another application.
> 
> I'm sure that there is a simple way to achieve the goal.
> 
> Any idea is greatly appreciated.
> 
> Regards,
> Wolfgang
> 
You could try something like this:

In[1]:=
conventionalForm[n_Integer] :=
   Times @@ MapThread[HoldForm[#1^#2] & ,
     Transpose[FactorInteger[n]]]

In[2]:=
conventionalForm[468]

Out[2]=
  2  2   1
2  3  13

In[3]:=
ReleaseHold[%]

Out[3]=
468

Best regards,
JM


  • Prev by Date: Re: Writing prime factor decomposision in conventional form
  • Next by Date: Re: Writing prime factor decomposision in conventional form
  • Previous by thread: Re: Writing prime factor decomposision in conventional form
  • Next by thread: Re: Writing prime factor decomposision in conventional form