Skip to content

Add Bailey-Borwein-Plouffe formula for hex digits of pi - #15723

Open
AnshMahajan-grep wants to merge 1 commit into
TheAlgorithms:masterfrom
AnshMahajan-grep:add-bailey-borwein-plouffe
Open

AnshMahajan-grep wants to merge 1 commit into
TheAlgorithms:masterfrom
AnshMahajan-grep:add-bailey-borwein-plouffe

Conversation

@AnshMahajan-grep

Copy link
Copy Markdown

Describe your change:

Adds an implementation of the Bailey-Borwein-Plouffe (BBP) formula in maths/bailey_borwein_plouffe.py.

The BBP formula is a spigot algorithm discovering in 1995 that allows direct extraction of any arbitrary hexadecimal (or binary) digit of $\pi$ without needing to calculate all preceding digits.

Key points:

  • Implemented with pure standard library Python.
  • Functions have complete type annotations and docstrings.
  • Doctests cover standard and boundary cases and pass with pytest.
  • Code conforms to formatting and lint rules (ruff).

References:

Checklist:

  • I have read the CONTRIBUTING.md guidelines.
  • All functions have type hints and docstrings with doctests.
  • All doctests pass locally.

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant