MathGroup Archive 1995

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

Search the Archive

FactorInteger Print Formatting

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg650] FactorInteger Print Formatting
  • From: Alan Powell <POWELLA at delphi.com>
  • Date: Thu, 06 Apr 1995 01:56:56 -0500 (EST)

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

FactorInteger[n] gives a list of prime factors of the integer n
in ascending order, together with their exponents viz:

  FactorInteger[900]    produces the list   {{2,2},{3,2},{5,2}}

What I need is a function called say factorform[list] such that:

  Print[ factorform[{{2,2},{3,2},{5,2}}] ]  produces  2^2*3^2*5^2

Ideally exponents equal to 1 would be suppressed so that when

  ff = FactorInteger[30]    produces    {{2,1},{3,1},{5,1}}    then

  Print[factorform[ff]]  would give  2*3*5  instead of  2^1*3^1*5^1  and

  Print[factorform[FactorInteger[2^6*3*5^2*7]]]  would give  2^6*3*5^2*7

A procedural solution is possible, but I was unable to create a simple
function which would give the desired result.


Alan Powell          POWELLA at delphi.com


  • Prev by Date: Hello, printing
  • Next by Date: Formula Output
  • Previous by thread: Hello, printing
  • Next by thread: Re: FactorInteger Print Formatting