Re: Sum of Prime factors
- To: mathgroup at smc.vnet.net
- Subject: [mg30833] Re: [mg30809] Sum of Prime factors
- From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
- Date: Thu, 20 Sep 2001 03:51:26 -0400 (EDT)
- References: <200109190416.AAA12694@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Shyam:
Here is function that will do what you wnat:
In[33]:=
DigitSumOfFactors = (FactorInteger[#] //
(# /. {a_?IntegerQ, b_?IntegerQ} :>
Table[IntegerDigits[a], {b}]) & //
Flatten //
(Plus @@ #) &) &;
In[34]:=
DigitSumOfFactors[55]
Out[34]=
7
In[35]:=
3
DigitSumOfFactors[13 ]
Out[35]=
12
Ken Levasseur
Math. Sciences
UMass Lowell
Shyam Sunder Gupta wrote:
>Can any body help in providing a simple mathematica code for finding sum
>of digits of prime factors(including repetitions) of a number. For
>example 198 =2*3*3*11 , so sum of digits of prime factors=
>2+3+3+1+1=10.
>
>Shyam Sunder Gupta
>email: guptass at rediffmail.com
>
- References:
- Sum of Prime factors
- From: "Shyam Sunder Gupta" <cec@cal2.vsnl.net.in>
- Sum of Prime factors