Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*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 2002

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

Search the Archive

Re: Re: The prime factors of n.


> >         I wish to receive a list of prime factors of n not in the
form
> > returned by FactorInteger. Instead I want only the primes the number
of
> > times they appear. As an example I will use 72. FactorInteger[72]
gives
> > { {2,3}, {3,2} }. I wish the list would read { 2, 2, 2, 3, 3 }. Is
the
> > following the best that I can do? f[n_Integer] := Module[{a =
> > FactorInteger[n], b = {}}, While[Length[a] > 0, Do[b = Append[b,
a[[1,
> > 1]]], {a[[1, 2]]}]; a = Drop[a, 1]]; b] .
> >
> > See
> >
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cg
i?Anum=037276
> >

Also:

f[n_] := Flatten[Table[First[#], {Last[#]}] & /@ FactorInteger[n]]



  • Prev by Date: Re: FullSimplify doesn't simplify
  • Next by Date: Re: FullSimplify doesn't simplify
  • Previous by thread: Re: The prime factors of n.
  • Next by thread: Re: The prime factors of n.