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 2002

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

Search the Archive

RE: The prime factors of n.

  • To: mathgroup at
  • Subject: [mg32718] RE: [mg32673] The prime factors of n.
  • From: "Florian Jaccard" <jaccardf at>
  • Date: Thu, 7 Feb 2002 05:10:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Hello Robert !

It's not better than your solution, but it works also !

First create the following function :

f[{x_, y_}] :=
  Flatten[Table[Transpose[{{x, y}}][[1]], Evaluate[Transpose[{{x,

Then the following :


g[72] gives the list you want !

Meilleures salutations

Florian Jaccard
e-mail : jaccardf at

-----Message d'origine-----
De : Robert G. Wilson v [mailto:rgwv at]
Envoyé : mer., 6. février 2002 09:41
À : mathgroup at
Objet : [mg32673] The prime factors of n.

Hello all,

        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] .


Sincerely yours,

Robert G. "Bob" Wilson, V

  • Prev by Date: Re: Docs for ml32i1.dll
  • Next by Date: Re: Docs for ml32i1.dll
  • Previous by thread: Re: The prime factors of n.
  • Next by thread: Re: The prime factors of n.