Skip to main content

A Python library for nerdy mathematical functions and number theory.

Project description

numnerd 🤓

License: MIT Python 3.7+

numnerd is a Python library dedicated to the pursuit of numerical excellence and the exploration of integer properties. The library currently features exactly 73 specialized functions, providing a comprehensive toolkit for the modern number theorist.

Whether you are seeking the next Mersenne prime, navigating the recursive paths of the Collatz conjecture, or calculating $\pi$ to a precision that would make a circle blush, numnerd provides the necessary tools.


🛠 Installation

You can install numnerd via pip:

pip install numnerd

Note: For those with a collaboration distance of zero to the source, cloning the repository is also an option.


🚀 Quick Start

Integration is straightforward. No complex axioms required.

from numnerd import is_prime, fibonacci, calculate_pi, is_happy_number

# Primality check
is_prime(17) # True

# The 10th term of the Fibonacci sequence
fibonacci(10) # 55

# Detecting "Happy" integers
is_happy_number(19) # True

# High-precision constants
calculate_pi(50)

📚 The Collection

Organized into four fundamental modules, the library provides a comprehensive toolkit for mathematical discovery.

🔢 Building Blocks (primes)

Tools for the analysis of primality and divisibility.

  • Classification: is_prime, is_perfect_number, is_sophie_germain_prime, is_twin_prime, is_mersenne_prime, is_chen_prime, is_fermat_prime.
  • Arithmetic Functions: prime_factorization, euler_totient ($\phi$), mobius_function ($\mu$), prime_pi ($\pi(n)$).
  • Search & Selection: sieve_of_eratosthenes, lcm, next_prime, prev_prime.
  • Conjectures: goldbach_partition.

🌀 Recursive Logic (sequences)

Exotic and classical integer sequences.

  • Foundations: fibonacci, lucas_number, catalan_number, triangular_number, pell_number, collatz_path.
  • Growth & Patterns: look_and_say, lazy_caterer, thue_morse_iteration, recaman_sequence, padovan_sequence, sylvester_sequence.
  • Combinatorial: bell_number, motzkin_number, juggler_sequence, golomb_sequence, perrin_number, narayana_cows.
  • Chaotic Systems: hofstadter_q, van_eck_sequence, wythoff_sequences.

🃏 Numerical Oddities (recreational)

Properties that emerge from the digits themselves.

  • Self-Referential: is_armstrong_number, is_munchausen_number, is_disarium_number, is_neon_number, is_kaprekar_number, is_automorphic_number.
  • Digit Dynamics: kaprekar_routine (6174), digital_root, is_spy_number, is_keith_number, is_vampire_number, is_polydivisible_number.
  • Divisor Relations: is_abundant_number, is_deficient_number, is_smith_number, is_pronic_number, is_happy_number.

♾️ Fundamental Constants (constants)

Arbitrary-precision calculation of the universe's most important ratios.

  • Universal Ratios: calculate_pi, calculate_e, calculate_golden_ratio, calculate_silver_ratio.
  • Roots & Logarithms: calculate_sqrt2, calculate_ln2, calculate_gauss_constant.
  • Physical & Mathematical Limits: calculate_catalan_constant, calculate_universal_parabolic_constant, calculate_aperys_constant, calculate_gelfond_constant, calculate_omega_constant, calculate_levy_constant.

🧪 Verification

We value rigor. The library maintains a 1:1 ratio of functions to tests.

python run_tests.py

📜 License

This project is licensed under the MIT License. As Paul Erdős would say, "A mathematician is a device for turning coffee into theorems"—this library is simply the byproduct of that process.


"Mathematics, rightly viewed, possesses not only truth, but supreme beauty." – Bertrand Russell

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numnerd-0.0.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numnerd-0.0.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file numnerd-0.0.2.tar.gz.

File metadata

  • Download URL: numnerd-0.0.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numnerd-0.0.2.tar.gz
Algorithm Hash digest
SHA256 79af606e24975bc269d6e8851f77e204cb2f2a94035b0b526a9352fc0eaf0b54
MD5 bca4666d470a1987575789015191b47b
BLAKE2b-256 9e6d522ebaa7b17020daf75a04a2c299fc56369d26180a25e1266375316d8d3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnerd-0.0.2.tar.gz:

Publisher: publish.yml on mduckwitz/numnerd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnerd-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: numnerd-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for numnerd-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8dd251439fc99a0f88f9942da7536594cabd82b76c96da3439bb1c2fd290b6
MD5 c2fe8a74ad15aee1cfa8216c0793132a
BLAKE2b-256 070c36d69fae82dd9fa43c97f890dc0c1a7e78008d12f9a1e61f90f141752438

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnerd-0.0.2-py3-none-any.whl:

Publisher: publish.yml on mduckwitz/numnerd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page