Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let summation = (start, end, a) => {
- let sum = 0;
- for (let n = start; n <= end; n++) sum += a(n);
- return sum;
- }
- console.log(4 * summation(0, 100000000, n => (n & 1 === 1 ? -1 : 1) / (2 * n + 1))); // 3.141592663589326
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement