Bill Allombert on Fri, 11 Dec 2020 08:48:19 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Sum over prime numbers function


On Fri, Dec 11, 2020 at 01:55:30AM +0000, Brereton, Ashley wrote:
> Hi all,
> 
> I wondered if there was a handy function to sum over only the prime
> numbers? Like a sum version of prodeuler.

No. Instead you can use forprime:

my(s=0);forprime(p=2,100,s+=f(p));s

Cheers,
Bill.