MathGroup Archive 2003

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

Search the Archive

Re: Summations with Primes


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