MathGroup Archive 2003

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

Search the Archive

Re: Summations with Primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39961] Re: [mg39932] Summations with Primes
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 13 Mar 2003 03:02:44 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Wednesday, March 12, 2003, at 02:29 AM, 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
>
>
>

Two options:

This function returns the number of primes including the smallest prime 
greater than or equal to n.

primeceiling[n_Integer]:=PrimePi[n]+If[PrimeQ[n],0,1]

You can use it to compute the sum as follows

Sum[f[Prime[i]],{i,

or you can simply check if i is prime

Sum[If[PrimeQ[i],f[i],0],{i,imin,imax}]

Regards,

Ssezi



  • Prev by Date: Re: Summations with Primes
  • Next by Date: Re: This should evaluate to zero
  • Previous by thread: Re: Summations with Primes
  • Next by thread: Re: Summations with Primes