Re: Summations with Primes
- To: mathgroup at smc.vnet.net
- Subject: [mg39972] Re: Summations with Primes
- From: dan_kefford at hotmail.com (Dan Kefford)
- Date: Thu, 13 Mar 2003 03:04:08 -0500 (EST)
- References: <b4mnus$imf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
How about this? SumOverPrimes[expr_, {i_, iMin_, iMax_}] := Module[{primeList, j, k}, primeList = Cases[Table[j, {j, iMin, iMax}], j_?PrimeQ] ; Return[Sum[expr /. i -> primeList[[k]], {k, 1, Length[primeList]}] ]; ] Cheers, dan kefford "Anthony Felder" <afelder at crsi.org> wrote in message news:<b4mnus$imf$1 at smc.vnet.net>... > Can you tell me if, when calculating a summation of f(i) where i goes from > imin to imax, Mathematica can be forced to only use prime values for i? > > Thank you for your time > > Anthony Felder