/*** Computation of the truncated Euler product for the Riemann zeta; s>1, A size of primes ***/ {zetaprodtail(s,A)= local(P, u); \\default(realprecision,27); \\ set working precision; P=1; u=-s; forprime(p=2, A , P=P*(1-p^u)); P= zeta(s) * P; return(P) } /*** Computation of the Meissel-Mertens constant ; A size of primes; T size of the tail of the series ***/ {MeisselMertens(A,K,prec)= local(S, Smtrunc, Smtail, u, B,err); default(realprecision,prec); \\ set working precision; Smtrunc=0; forprime(p=2, A , Smtrunc=Smtrunc+log(1-1/p)+1/p); Smtail=0; for(k=2,K,Smtail=Smtail+ moebius(k)*log(zetaprodtail(k,A))/k); S=Smtrunc+Smtail; B=A^(-1); err= (2*B^K)/(K^2*(1-B))*1.0; print("The Meissels-Mertens constant is = ", S); print("error <= ", err); print("number of correct digits =", floor(abs(log(err)/log(10)))-2); \\ print("check= ", check) } /*** Begin Examples *** ---------------- DOUBLE QUADCORE: ---------------- [languasc@labsrv0 ~]$ nice /usr/local/Gruppi/PariGP/bin/gp2c-run -pmy_ -g -W MM.gp Warning:MM.gp:24: variable undeclared err MM.gp.c: In function `my_MeisselMertens': MM.gp.c:58: warning: unused variable `my_u' GP/PARI CALCULATOR Version 2.3.2 (released) amd64 running linux (x86-64/GMP-4.2.2 kernel) 64-bit version compiled: Nov 30 2007, gcc-3.4.3 20041212 (Red Hat 3.4.3-9.EL4) (readline v4.3 enabled, extended help available) Copyright (C) 2000-2006 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?12 for how to get moral (and possibly technical) support. parisize = 8000000, primelimit = 500000 ? # timer = 1 (on) ? MeisselMertens(100,55,120) The Meissels-Mertens constant is = -0.315718452053890076851085251473706571990592687678724392613703020959943215880296461222804431857500098463013718373321057886 error <= 6.67835378579180232072794056265130645295934552132899240337256866182486017196760998413890975874446948827114116370314717422 E-114 number of correct digits =111 time = 13 ms. ? MeisselMertens(145,465,1030) The Meissels-Mertens constant is = -0.3157184520538900768510852514737065719905926876787243926137030209599432158802964612228044318575000984630137183733210604831771136902164984116806865956725371295915507766490115206099262006727426701744321953672905616222654354221813794548722719888996983603464775075042151471260985072034869703953841657069312043061193990767938648328971026366125727429059790502319663815335975014933517486876418374358920033510680467030081090000239001724710326775087593883888727056617317217288459690528553326381485866337838260202448105584306578711544331026109143107278649055077194338657184611847742453321356949201899818830007698946339054232597324044523108273629448996753585260110837150106382801011582133307473618984043336555039416044394216160023789032900035523133437959838998440855452214155503003671554505848920943085236532258782325169589466002099976732811576852771064260479306479260464076807925340928996537718041690466426445608385836566231914789440983186322521765181733624898961864316445864115306494834675812511894932665472751598777273317342416753483354244 error <= 8.570547392235658227002198342342089607611390385934303043045964457723207435691294280073173622953758154354639478850208618799753203089374794209203234950711990115728469327762308028670878231313030526405422315483231110346950858203451959484585365990625864756666398224746411126844315955046431072251536856392035172697206433159956100395616034345059102202111207147652594864056297793719507602181125896826991086923126529934302827798778191537474238199046468073552854796362606474806184658880485469361864201720262122009100410402068583281223279325516647170751375742267769168705436482508167744021659908587581837647156402324446019732543425905480575603175312648657341370409246348813844883264500964239692338587595156812082565044605543390462632138133501362931729128845662405781830334195623828162711373206066728479327673536704254872348278231826335563605418706213752248936047021751053175379816006276617866161361842025496817085793512781832721497012962068600095604519895688096599112805024573837662981624521481977621012142579954002003823777098397488404869176 E-1011 number of correct digits =1008 time = 4,897 ms. ? *** End Examples ***/