Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: 8 bit and FactorInteger ...

  • To: mathgroup at
  • Subject: [mg14527] Re: 8 bit and FactorInteger ...
  • From: Paul Abbott <paul at>
  • Date: Thu, 29 Oct 1998 04:33:25 -0500
  • Sender: owner-wri-mathgroup at

Jens-Peer Kuska wrote:

> FactorIntegerForm[faci_]:=
>    DisplayForm[Infix[SuperscriptBox[Sequence @@ #] & /@
> faci,"\[Times]"]]

Nice. So things like


work. Two questions:

[1] What is the easiest/best way to get the result back as a number
(i.e. remove the DisplayForm wrappers, etc)?

[2] Is there an easy way to associate FactorForm with FactorInteger

Note however that

[1] if the exponent is 1 it is still printed.

[2] your code does not handle GaussianIntegers, e.g.,


Here is a different approach by Paul Wellin with some additions by Stan
Wagon which handles unit exponents and Complex factors.  I expect that
you could extend your code (which makes nice use of Infix) to handle
the Complex case as well.

FactorForm[{}] = 1;

FactorForm[l_] :=  (
temp = RowBox[{#, "\[CenterDot]"}] &  /@
  If[#2 == 1,
    StringJoin["(", ToString[#1], ")"],
    ToString at #1], SuperscriptBox[ToString at #1, #2]]&,
   ReplacePart[temp, Drop[temp[[-1,1]],-1],{{-1,1}}])

FactorForm[FactorInteger[12333000, GaussianIntegers->True]]

Note that this is still not perfect: if you use TraditionalForm for
output (as I do) the String conversion changes \[ImaginaryI] into I.


Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia           Nedlands WA  6907
mailto:paul at AUSTRALIA

            God IS a weakly left-handed dice player

  • Prev by Date: nonlinear regress on multiple data sets?
  • Next by Date: beep after calculation
  • Previous by thread: nonlinear regress on multiple data sets?
  • Next by thread: beep after calculation