Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhrankan-Chakrabarti authored Jun 21, 2024
1 parent 836c9ee commit 368724b
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,41 @@
# pi-calculation-with-catalan-numbers
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.
# π Calculation with Catalan Numbers

This repository contains a Python script to calculate the digits of π using Catalan numbers and fixed-point arithmetic.

## 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 used in this algorithm is:

\[ \pi = 3 + 6 \sum_{n=1}^{\infty} \frac{(2n - 1) \cdot C_n}{(2n + 1) \cdot 16^n} \]

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:

```sh
python pi_gmpy.py
```

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

## Example

```sh
$ 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.

0 comments on commit 368724b

Please sign in to comment.