/nilakantha_pi

Nilakantha series PI calculation

Primary LanguageElixir

Nilakantha PI

Calculate PI recursively using Nilakantha series:

π = 3 +4(2×3×4) −4(4×5×6) +4(6×7×8) −4(8×9×10) ...

Examples

iex> Nilakantha.calculate_pi(1_000)

3.141592653340544