Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Summations with Primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39958] Re: Summations with Primes
  • From: Friedrich Laher <mathefritz at schmieder-laher.de>
  • Date: Thu, 13 Mar 2003 03:02:27 -0500 (EST)
  • References: <b4mnus$imf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

use wrapper
ff[i_]:=If[PrimeQ[i],f[i],0]
and do the summation with ff instead of f
or
take the If direktly as the expression to Sum, e.g.

Sum[If[PrimeQ[i],i,0],{i,0,20}]
77

Anthony Felder schrieb:
> 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
> 
> 



  • Prev by Date: How to solve numeriquement the laplace's equation on the spherical surface
  • Next by Date: Re: Summations with Primes
  • Previous by thread: Re: Summations with Primes
  • Next by thread: Re: Summations with Primes