Skip to main content

Efficient computation of factorial sums using a novel recursive identity

Project description

Factorial Sum

Factorial Sum is a Python library for efficient and exact computation of factorial sums S(𝑛) = 1! + 2! + 3! + ... n! using a novel recursive identity introduced by Abdelkrim Meziani (2025). This approach improves numerical stability, reduces recursion depth, and provides better performance compared to naive methods.

Installation

pip install factorial-sum

Usage

from factorial_sum import factorial_sum

# Compute the sum of the first 5 factorials
print(factorial_sum(5))  # Output: 153

Features

  • Efficient algorithm based on a new recursive identity: S(n) = n² * (n-2)! + S(n-3)
  • Faster than naive summation for large n
  • Safe for large n using iterative computation (no recursion errors).
  • Mathematically exact with Python’s arbitrary-precision integers.
  • Lightweight & dependency-free (only uses Python standard library)
  • Includes caching for performance
  • Fully tested with pytest

Applications

  • Combinatorics and permutation analysis
  • Graph enumeration problems
  • Factorial number systems
  • Teaching recursion and algorithm optimization
  • Benchmarking and computational mathematics research

Citation

If you use this package in academic work, please cite:

Abdelkrim Meziani (2025). A Novel Recursive Identity for the Sum of Factorials with Computational and Combinatorial Applications. [https://zenodo.org/records/16994879 / https://orcid.org/0009-0003-1849-4985]

Author

Abdelkrim Meziani

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

factorial_sum-0.1.2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

factorial_sum-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file factorial_sum-0.1.2.tar.gz.

File metadata

  • Download URL: factorial_sum-0.1.2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for factorial_sum-0.1.2.tar.gz
Algorithm Hash digest
SHA256 91aaaf7b6e271220d80ea9796c152122c5601dce21c2f6a03c9957c8b761711f
MD5 90d5f1580b1a64678b62b0e4bc837cb4
BLAKE2b-256 becf36b3e1655845d51b88184ff3a2eddc7bcddd04b658b44704f8eafe7c496e

See more details on using hashes here.

File details

Details for the file factorial_sum-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: factorial_sum-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for factorial_sum-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef7aa72c88f0dcc0c4659b131bd09d04176df8d4b41cc7a6d1ac5c438bef1dee
MD5 d226526568f43dabbc0568a4af6885cc
BLAKE2b-256 44b365c0a63a4afe0826f488ddc06e43a404383d459f3dc141b08813fcf8196e

See more details on using hashes here.

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