Wednesday, February 15, 2017

more Π obscurantism

Here's an illustration of an approach to pi pointed out by Kevin Brown. Define f(n) as the nearest greater or equal multiple of n-1, then of n-2, etc (yielding OEIS sequence 2491). Then, inverting a result found by Duane Broline and Daniel Loeb, pi = n2 / f(n).

But as you can see from the comment, the series converges very slowly!

main = print $ e**2 / f e e 1
 where
  e = 900000  -- yields 3.1416003...

f n 1 _ = n
f n k l = f n' (k - 1) $ n' / k
 where
  n' = head $ dropWhile (< n) $ map (* k) [l..]

No comments:

Post a Comment