| 84 | // ζ(3) = 5/2 · Σ_{n≥1} (-1)^(n-1) / (n³ · C(2n,n)); term ~ /64 per step → |
| 85 | // ~0.55·prec terms for prec digits. Recomputed in full each call (no memo). |
| 86 | function zeta3() { |
| 87 | const half = new B('0.5'); |
| 88 | let sum = new B(0); |
| 89 | let binom = 1n; // C(2n,n) |
| 90 | const terms = Math.ceil(prec * 0.6) + 4; |
| 91 | for (let n = 1; n <= terms; n++) { |
| 92 | binom = (binom * BigInt(2 * n) * BigInt(2 * n - 1)) / (BigInt(n) * BigInt(n)); |
| 93 | const denom = new B(BigInt(n * n * n) * binom); |
| 94 | const t = B.ONE.div(denom); |
| 95 | sum = (n & 1) === 1 ? sum.add(t) : sum.sub(t); |
| 96 | } |
| 97 | return sum.mul(half).mul(new B(5)); // 5/2 · Σ |
| 98 | } |
| 99 | |
| 100 | // ---- op table ------------------------------------------------------------- |
| 101 | // Each is a closure taking the call counter `i` (already masked) and doing ONE |