Re: Sum of Prime factors
- To: mathgroup at smc.vnet.net
- Subject: [mg30856] Re: [mg30809] Sum of Prime factors
- From: BobHanlon at aol.com
- Date: Thu, 20 Sep 2001 03:52:06 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/9/19 12:43:30 AM, cec at cal2.vsnl.net.in writes: >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. digitSumOfFactors[n_Integer] := Plus@@ Flatten[ IntegerDigits /@ Flatten[Table[#[[1]], {#[[2]]}]& /@ FactorInteger[n]]]; digitSumOfFactors[198] 10 Bob Hanlon Chantilly, VA USA