Student Support Forum
-----
Student Support Forum: 'Prime Divisors' topicStudent Support Forum > General > Archives > "Prime Divisors"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic | Post New Topic
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,

Subject (listing for 'Prime Divisors')
Author Date Posted
Prime Divisors stephanos 07/03/08 06:20am
Re: Prime Divisors S. Saralamba 07/06/08 11:46pm
Re: Prime Divisors Xavier 07/07/08 01:09am
Re: Prime Divisors yehuda ben-s... 07/07/08 07:00am
Re: Prime Divisors VolMike 07/08/08 2:27pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic | Post New Topic





 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: