mersenneforum.org summation in pari gp
 Register FAQ Search Today's Posts Mark Forums Read

 2022-08-12, 07:51 #1 Adrian   Aug 2022 116 Posts summation in pari gp Is there any command to evaluate in PARI GP such sum: $$\sum\limits_{\substack{2\leq d\leq n \\ (d, n)=1}}\frac{a\left(n\right)}{d}$$? In other words: how to add to command sum(d=2, n, \frac{a(n)}{d}) condition from second line $(d,n)=1$) (or more such conditions) Last fiddled with by LaurV on 2022-08-12 at 09:40 Reason: fixed the formula
 2022-08-12, 09:48 #2 LaurV Romulan Interpreter     "name field" Jun 2011 Thailand 1028110 Posts you mean this? Code: gp > sum(d=1,20,if(d%2==0&&d%3==0,1./d,0),0) %1 = 0.30555555555555555555555555555555555556 gp > 1./6+1/12+1/18 %2 = 0.30555555555555555555555555555555555556 gp > Pari is a programing language, how you combine the stuff is up to you (p.s. I also edited your post and fixed your formula)

 Similar Threads Thread Thread Starter Forum Replies Last Post User133 PARI/GP 46 2020-06-15 11:29 paul0 Programming 2 2015-11-17 13:04 skan Miscellaneous Math 0 2012-12-16 00:13 devarajkandadai Programming 21 2012-08-31 18:08 roger Math 2 2008-04-18 07:04

All times are UTC. The time now is 23:42.

Sun Feb 5 23:42:12 UTC 2023 up 171 days, 21:10, 1 user, load averages: 0.86, 0.87, 0.89