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
>
>