Continued fraction: Difference between revisions

→‎{{header|F_Sharp|F#}}: Add Apéry's constant
(add RPL section)
(→‎{{header|F_Sharp|F#}}: Add Apéry's constant)
Line 1,293:
2.71828165766640 < e < 2.71828184277783
2.71828182735187 < e < 2.71828184277783
</pre>
===Apéry's constant===
See [https://tpiezas.wordpress.com/2012/05/04/continued-fractions-for-zeta2-and-zeta3/ Continued fractions for Zeta(2) and Zeta(3)] section II. Zeta(3)
<syntaxhighlight lang="fsharp">
let aπ()=let mutable n=0 in (fun ()->n<-n+1;-decimal(pown n 6))
let bπ()=let mutable n=0M in (fun ()->n<-n+1M; (2M*n-1M)*(17M*n*n-17M*n+5M))
cf2S (aπ()) (bπ()) |>Seq.map(fun n->6M/n) |> Seq.take 10 |> Seq.pairwise |> Seq.iter(fun(n,g)->printfn "%1.20f < p < %- 1.20f" (min n g) (max n g));;
</syntaxhighlight>
{{out}}
<pre>
1.20205479452054794521 < p < 1.20205690119184928874
1.20205690119184928874 < p < 1.20205690315781676650
1.20205690315781676650 < p < 1.20205690315959270361
1.20205690315959270361 < p < 1.20205690315959428400
1.20205690315959428400 < p < 1.20205690315959428540
1.20205690315959428540 < p < 1.20205690315959428540
1.20205690315959428540 < p < 1.20205690315959428540
1.20205690315959428540 < p < 1.20205690315959428540
1.20205690315959428540 < p < 1.20205690315959428540
</pre>
 
2,171

edits