RE: Sum of Prime factors
- To: mathgroup at smc.vnet.net
- Subject: [mg30837] RE: [mg30809] Sum of Prime factors
- From: "Harvey P. Dale" <hpd1 at nyu.edu>
- Date: Thu, 20 Sep 2001 03:51:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Shyam:
This does it:
sumDPF[n_] := Plus @@ Flatten[IntegerDigits[#] & /@
(Flatten[Table[#[[1]], {#[[2]]}] & /@ FactorInteger[n]])]
Then: sumDPF[198] yields 10.
Best,
Harvey
Professor Harvey P. Dale
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: Shyam Sunder Gupta [mailto:cec at cal2.vsnl.net.in]
To: mathgroup at smc.vnet.net
Sent: Wednesday, September 19, 2001 12:17 AM
To: mathgroup at smc.vnet.net
Subject: [mg30809] Sum of Prime factors
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
_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp