Re: The prime factors of n.

• To: mathgroup at smc.vnet.net
• Subject: [mg32748] Re: [mg32673] The prime factors of n.
• From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
• Date: Fri, 8 Feb 2002 03:49:20 -0500 (EST)
• References: <200202060841.DAA02157@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Bob:

Here's one way to do it:

f = ToExpression[StringJoin[
(Table[ToString[First[#1]], {Last[#1]}] & ) /@
FactorInteger[#1]]] &

In[8]:=
Map[f,Range[2,10]]

Out[8]=
{2, 3, 22, 5, 23, 7, 222, 33, 25}

Ken Levasseur
UMass Lowell

"Robert G. Wilson v" wrote:

> 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?Anum=037276
>
> Sincerely yours,
>
> Robert G. "Bob" Wilson, V

```

• Prev by Date: Re: NDSolve with side conditions:
• Next by Date: Re: file.txt and/or file.xls to take file in Mathematica
• Previous by thread: Re: The prime factors of n.
• Next by thread: Re: Re: The prime factors of n.