-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
836c9ee
commit 368724b
Showing
1 changed file
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |