(phixonline)-->
with javascript_semantics
requires("1.0.0") -- (mpfr_set_default_prec[ision] has been renamed)
-- (and mpfr_sprintf() replaced with mpfr_get_fixed())
include mpfr.e
mpz n = mpz_init(2), nm1 = mpz_init()
mpfr_set_default_precision(720)
mpfr {rn, tmp} = mpfr_inits(2)
for i=1 to 10 do
if i>1 then
mpz_sub_ui(nm1,n,1)
mpz_mul(n,nm1,n)
mpz_add_ui(n,n,1)
end if
printf(1,"%d: %s\n",{i,mpz_get_str(n)})
mpfr_set_z(tmp,n)
mpfr_si_div(tmp,1,tmp)
mpfr_add(rn,rn,tmp)
end for
printf(1,"sum of reciprocals: %s\n",{shorten(mpfr_get_fixed(rn,211))})