Anthony:
It's not clear to me whether you wish i to be the index of the
prime number, or merely an integer. If you wish the former, this should
do it (assuming i goes from 30 to 70, for example):
Sum[Prime[i],{i,30,70}]
If you wish the latter, this should do it (assuming i goes from 30 to
70, for example:
Plus@@Select[Range[30,70],PrimeQ]
but if the range is large, e.g., from 30 to 7000, the following might be
faster:
Plus@@Prime[Range[PrimePi[30]+1,PrimePi[7000]]]
Best,
Harvey
Harvey P. Dale
University Professor of Philanthropy and the Law
Director, National Center on Philanthropy and the Law
New York University School of Law
Room 206A
110 West 3rd Street
New York, N.Y. 10012-1074
-----Original Message-----
From: Anthony Felder [mailto:afelder at crsi.org]
To: mathgroup at smc.vnet.net
Subject: [mg39978] [mg39932] Summations with Primes
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