MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Summations with Primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39974] Re: Summations with Primes
  • From: Olaf Rogalsky <Olaf.Rogalsky at physik.uni-erlangen.de>
  • Date: Thu, 13 Mar 2003 03:04:22 -0500 (EST)
  • Organization: University of Erlangen, Germany
  • References: <b4mnus$imf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Anthony Felder wrote:
> 
> 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
Sum[If[PrimeQ[i],f[i],0],{i,imin,imax}]

or better

Sum[f[Prime[i]], {i, PrimePi[imin-1]+1, PrimePi[imax]}]


-- 
+----------------------------------------------------------------------+
I Dr. Olaf Rogalsky                         Institut f. Theo. Physik I I
I Tel.: 09131 8528440                       Univ. Erlangen-Nuernberg   I
I Fax.: 09131 8528444                       Staudtstrasse 7 B3         I
I rogalsky at theorie1.physik.uni-erlangen.de  D-91058 Erlangen           I
+----------------------------------------------------------------------+


  • Prev by Date: Don't understand Plot behavior
  • Next by Date: Re: This should evaluate to zero
  • Previous by thread: Re: Re: Summations with Primes
  • Next by thread: RE: Summations with Primes