Jump to content

Apéry's constant: Difference between revisions

Add PARI/GP implementation
(Add Python implementation)
(Add PARI/GP implementation)
Line 346:
First 20 terms of Wedeniwski representation truncated to 100 decimal places:
1.2020569031595942853997381615114499907649862923404988817922715553418382057863130901864558736093352581
</pre>
 
=={{header|PARI/GP}}==
<syntaxhighlight lang="PARI/GP">
\\ Set the precision to, say, 110 digits
default(realprecision, 110);
 
\\ Function to display Apéry's constant
my_show_apery_constant(expr, caption) = printf("%s %.101g\n\n", caption, expr);
 
\\ Apéry's constant via PARI/GP's zeta function
my_show_apery_constant(zeta(3), "Apéry's constant via PARI/GP's Zeta:\n");
 
\\ Apéry's constant via reciprocal cubes
my_show_apery_constant(sum(k = 1, 1000, 1/k^3), "Apéry's constant via reciprocal cubes:\n");
 
\\ Apéry's constant via Markov's summation
my_show_apery_constant((5/2) * sum(k = 1, 158, (-1)^(k - 1) * (k!)^2 / ((2*k)! * k^3)), "Apéry's constant via Markov's summation:\n");
 
\\ Apéry's constant via Wedeniwski's summation
my_show_apery_constant(1/24 * sum(k = 0, 19, (-1)^k * ((2*k + 1)!)^3 * ((2*k)!)^3 * (k!)^3 * (126392*k^5 + 412708*k^4 + 531578*k^3 + 336367*k^2 + 104000*k + 12463) / (((3*k + 2)!) * ((4*k + 3)!)^3)), "Apéry's constant via Wedeniwski's summation:\n");
</syntaxhighlight>
{{out}}
<pre>
Apéry's constant via PARI/GP's Zeta:
1.2020569031595942853997381615114499907649862923404988817922715553418382057863130901864558736093352581
 
Apéry's constant via reciprocal cubes:
1.2020564036593442854830714115115999903483212709031775135036540966118572571921400836130084123260473112
 
Apéry's constant via Markov's summation:
1.2020569031595942853997381615114499907649862923404988817922715553418382057863130901864558736093352581
 
Apéry's constant via Wedeniwski's summation:
1.2020569031595942853997381615114499907649862923404988817922715553418382057863130901864558736093352581
 
 
</pre>
 
338

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.