RE: The prime factors of n.

• To: mathgroup at smc.vnet.net
• Subject: [mg32717] RE: [mg32673] The prime factors of n.
• From: "Harvey P. Dale" <hpd1 at nyu.edu>
• Date: Thu, 7 Feb 2002 05:10:00 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Bob:
This is both more compact and faster:
Flatten[Table[#[[1]],{#[[2]]}]&/@FactorInteger[72]]
Best,
Harvey
Harvey P. Dale
University Professor of Philanthropy and the Law
Director, National Center on Philanthropy and the Law
New York University School of Law
Room 206A
110 West 3rd Street
New York, N.Y. 10012-1074
tel: 212-998-6161
fax: 212-995-3149

-----Original Message-----
From: Robert G. Wilson v [mailto:rgwv at kspaint.com]
To: mathgroup at smc.vnet.net
Subject: [mg32717] [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] .

See
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?An
um=037276

Sincerely yours,

Robert G. "Bob" Wilson, V

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan