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.3.tar.gz (17.6 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.3-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: numnerd-0.0.3.tar.gz
  • Upload date:
  • Size: 17.6 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.3.tar.gz
Algorithm Hash digest
SHA256 24a548ea2c91c3c6313da84feccec66ac7553f84e407e3700aac77807afcab1f
MD5 ec7c8fe012ef77929b4583356f44332c
BLAKE2b-256 a1ec5ed68e7b4d5d8ca347be41a011811ade4a1fee601ad38b9cce4691bc68fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnerd-0.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: numnerd-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e50e204eb444963a262c79caaa25f035cca47dca04d0dd65a3cafe56251342eb
MD5 23c40dae2bc159c247d7caf771cf6e9b
BLAKE2b-256 1543700a04b747d5078e50797fb24c35455c49f17ae87abd9197b2d129bc640f

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnerd-0.0.3-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