RE: Sum of Prime factors
- To: mathgroup at smc.vnet.net
- Subject: [mg30864] RE: [mg30809] Sum of Prime factors
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>
- Date: Fri, 21 Sep 2001 04:04:02 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> -----Original Message----- > From: Shyam Sunder Gupta [mailto:cec at cal2.vsnl.net.in] To: mathgroup at smc.vnet.net > Sent: Wednesday, September 19, 2001 6:17 AM > Subject: [mg30864] [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 > Not being shure what you want to attain, please try Plus @@ Times @@@ FactorInteger[a] Plus @@ Flatten@(IntegerDigits /@ Times @@@ FactorInteger[a]) Plus @@ Flatten@(IntegerDigits[#1]*#2 & @@@ FactorInteger[a]) All these function coincide on a=35, the last two on a = 198, and all differ at a=56491710780978 -- Hartmut Wolf