Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: FactorInteger Print Formatting

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg768] Re: [mg650] FactorInteger Print Formatting
  • From: Count Dracula <lk3a at kelvin.seas.virginia.edu>
  • Date: Tue, 18 Apr 1995 01:02:13 -0400
  • Organization: University of Virginia

Alan Powell <POWELLA at delphi.com> wrote:

>Could anyone suggest a neat way to reformat the output of
>FactorInteger into a more usable print format?

The function fa below is a slightly shortened version of
the function fa given in [mg700]:

   fa[1] := "1"

   fa[n_Integer] := 
    StringDrop[ StringJoin[ Flatten[Map[ToString, FactorInteger[n], {2}] /. 
       {a_String, b_} :> {a, b /.{"1" -> "*", x_ -> "^"<> x <> "*"}} ] ], -1]
                


In[3]:= fa[9009]

Out[3]= 3^2*7*11*13

In[4]:= fa[129348]

Out[4]= 2^2*3^2*3593

-- 
 ___________________________________________________________________________________
 Levent Kitis           lk3a at cars.mech.virginia.edu    lk3a at kelvin.seas.virginia.edu
 University of Virginia  Department of Mechanical, Aerospace and Nuclear Engineering  
 ___________________________________________________________________________________


  • Prev by Date: Re: Re: FactorInteger Print Formatting
  • Next by Date: Re: Time Series
  • Previous by thread: Re: Re: FactorInteger Print Formatting
  • Next by thread: Re: FactorInteger Print Formatting