# 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
```bash
pip install factorial-sum
```
## Usage
```python
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**
Raw data
{
"_id": null,
"home_page": null,
"name": "factorial-sum",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "factorial, mathematics, combinatorics, recursion, number-theory",
"author": null,
"author_email": "Abdelkrim Meziani <ramziabdelkrim@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/be/cf/36b3e1655845d51b88184ff3a2eddc7bcddd04b658b44704f8eafe7c496e/factorial_sum-0.1.2.tar.gz",
"platform": null,
"description": "\r\n# Factorial Sum\r\n\r\nFactorial Sum is a Python library for efficient and exact computation of factorial sums\r\nS(\ud835\udc5b) = 1! + 2! + 3! + ... n!\r\nusing a novel recursive identity introduced by Abdelkrim Meziani (2025).\r\nThis approach improves numerical stability, reduces recursion depth, and provides better performance compared to naive methods.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install factorial-sum\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom factorial_sum import factorial_sum\r\n\r\n# Compute the sum of the first 5 factorials\r\nprint(factorial_sum(5)) # Output: 153\r\n```\r\n\r\n## Features\r\n\r\n- Efficient algorithm based on a new recursive identity:\r\n S(n) = n\u00b2 * (n-2)! + S(n-3)\r\n- Faster than naive summation for large n\r\n- Safe for large n using iterative computation (no recursion errors).\r\n- Mathematically exact with Python\u2019s arbitrary-precision integers.\r\n- Lightweight & dependency-free (only uses Python standard library)\r\n- Includes caching for performance\r\n- Fully tested with pytest\r\n\r\n## Applications\r\n\r\n- Combinatorics and permutation analysis\r\n- Graph enumeration problems\r\n- Factorial number systems\r\n- Teaching recursion and algorithm optimization\r\n- Benchmarking and computational mathematics research\r\n\r\n## Citation\r\n\r\nIf you use this package in academic work, please cite:\r\n\r\nAbdelkrim Meziani (2025).\r\nA Novel Recursive Identity for the Sum of Factorials with Computational and Combinatorial Applications.\r\n[https://zenodo.org/records/16994879 / https://orcid.org/0009-0003-1849-4985]\r\n\r\n## Author\r\n\r\n**Abdelkrim Meziani**\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Efficient computation of factorial sums using a novel recursive identity",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://pypi.org/project/factorial-sum/",
"Homepage": "https://github.com/yourusername/factorial-sum",
"Source": "https://github.com/yourusername/factorial-sum"
},
"split_keywords": [
"factorial",
" mathematics",
" combinatorics",
" recursion",
" number-theory"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "44b365c0a63a4afe0826f488ddc06e43a404383d459f3dc141b08813fcf8196e",
"md5": "d226526568f43dabbc0568a4af6885cc",
"sha256": "ef7aa72c88f0dcc0c4659b131bd09d04176df8d4b41cc7a6d1ac5c438bef1dee"
},
"downloads": -1,
"filename": "factorial_sum-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d226526568f43dabbc0568a4af6885cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3833,
"upload_time": "2025-09-01T18:21:30",
"upload_time_iso_8601": "2025-09-01T18:21:30.739784Z",
"url": "https://files.pythonhosted.org/packages/44/b3/65c0a63a4afe0826f488ddc06e43a404383d459f3dc141b08813fcf8196e/factorial_sum-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "becf36b3e1655845d51b88184ff3a2eddc7bcddd04b658b44704f8eafe7c496e",
"md5": "90d5f1580b1a64678b62b0e4bc837cb4",
"sha256": "91aaaf7b6e271220d80ea9796c152122c5601dce21c2f6a03c9957c8b761711f"
},
"downloads": -1,
"filename": "factorial_sum-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "90d5f1580b1a64678b62b0e4bc837cb4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3650,
"upload_time": "2025-09-01T18:21:31",
"upload_time_iso_8601": "2025-09-01T18:21:31.966997Z",
"url": "https://files.pythonhosted.org/packages/be/cf/36b3e1655845d51b88184ff3a2eddc7bcddd04b658b44704f8eafe7c496e/factorial_sum-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-01 18:21:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "factorial-sum",
"github_not_found": true,
"lcname": "factorial-sum"
}