Skip to content

This repository contains a Python script that calculates the digits of π (pi) using a novel algorithm based on Catalan numbers and fixed-point arithmetic. The algorithm efficiently computes the digits of π by leveraging the properties of Catalan numbers, making it a unique and effective method for high-precision calculations.

License

Notifications You must be signed in to change notification settings

Abhrankan-Chakrabarti/pi-calculation-with-catalan-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Catalan π Algorithm

This repository contains an implementation of a newly discovered algorithm for calculating the digits of π using Catalan numbers, derived from 6 \arcsin(0.5). The algorithm uses high-precision arithmetic and optimized series summation to achieve efficient computation.

Introduction

Calculating the digits of π has been a topic of interest for mathematicians and computer scientists alike. This project introduces a novel algorithm for π calculation that leverages Catalan numbers and fixed-point arithmetic.

Algorithm

The series representation for π used in this algorithm is derived from the inverse sine function:

\pi = 6 \arcsin(0.5)

By expanding \arcsin(x) as a series, we get:

series

Substituting x = 0.5 and multiplying by 6, we derive the series:

series

Where C_n is the nth Catalan number.

Implementation

The implementation of the algorithm in Python can be found in the pi_gmpy.py file.

Usage

To use the script, run the following command in your terminal:

python pi_gmpy.py

You will be prompted to enter the number of digits of π you want to calculate.

Example

$ python pi_gmpy.py
How many digits of π? : 100
π = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...∞

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or feedback, feel free to reach out via GitHub or email.

About

This repository contains a Python script that calculates the digits of π (pi) using a novel algorithm based on Catalan numbers and fixed-point arithmetic. The algorithm efficiently computes the digits of π by leveraging the properties of Catalan numbers, making it a unique and effective method for high-precision calculations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages