| Author |
Comment/Response |
Xavier
|
07/07/08 01:09am
Hey,
See the new definitions below:
g[n_] := Select[Divisors[n], PrimeQ]
f[n_] := Total[g[n]]
The first difference is the ":=" instead of "=" : if you want n to be understood on the right hand side, you must use a SetDelayed sign.
The second difference is that you should use Select, choosing to take only those which are Primes. Your method was good, but Primes is not defined explicitly since this is an infinite set of integers. You cannot also use it for an Intersection.
Hope it helps. Please ask if any question
Cheers,
Xavier
URL: http://xroudaut.free.fr, |
|