Bernoulli
Intended for calculating partial sums of powers of natural numbers. Can also print n+1 Bernoulli numbers, do python math, cache crucial numbers. Warning: Not fitting for server. Has many vunerabilities. Can launch arbitrary code.
Install / Use
/learn @Siiir/BernoulliREADME
Bernoulli

This Python package offers robust tools for calculating partial sums of powers of natural numbers and managing Bernoulli numbers with optimized caching techniques. Ideal for mathematicians, researchers, and software developers interested in number theory or computational mathematics.
Features 🌟
- Compute LARGE Partial Sums: Utilize Faulhaber's formula to compute sums of powers of very long natural numbers.
- Bernoulli Numbers Generation: Efficiently generate Bernoulli numbers using the Akiyama–Tanigawa algorithm.
- Caching System: Persistent caching of computations to enhance performance of successive operations.
- Command Line Interface: Versatile CLI support for interactive and script-based usage.
- Library for your app: You can
import bernoullito make it a part of your app.
Getting Started 🚀
To get started with bernoulli.
- Clone the repository.
git clone https://github.com/Siiir/bernoulli
- Go to the repo folder.
cd bernoulli
- Run the following command in your terminal:
python bernoulli.py help
Examples
Here are some quick examples to show you the power of the Bernoulli package.
Calculating the nth Bernoulli Number
This command prints the 6th Bernoulli number.
python bernoulli.py nth 6
Or, in interactive mode type nth(6).
Printing Bernoulli Numbers up to k
Lists the first 11 Bernoulli numbers (0 to 10).
python bernoulli.py up_to 10
Or, in interactive mode type up_to(10).
Sum of Powerful Powers
- Calculates the sum of the the first (1 vigintillion + ...) of positive natural numbers, each taken to the power of
k=1873.
python bernoulli.py psum 1509096632309561804061385286158050392946131124427766465467743034 1873
- Or, in interactive mode type
psum(1509096632309561804061385286158050392946131124427766465467743034, 1873)
- I have choosen a "small"
nfor the purpose of readability. You can try increasing the first argument quite freely. Whereas increasing thekwill have a noticable computional cost.
Complex equations using Python3's math functions and builtins
Interactive mode only.
sin(psum(20, 3) - psum(10, 3)) + 2**6
Documentation 📚
Online documentation
Interactive documentation
Detailed documentation is available within the module. Use the help command for more information on specific functions:
python bernoulli.py help nth_Bernoulli_num
Or, in interactive mode type
help(nth_Bernoulli_num)
You can even use short aliases.
help(nth)
Thinking in big terms
- As of time of writing the most optimized is the interactive mode as it doesn't need to perform the startup (big cache deserialization) between calls to different app commands. It also supports session-local, in-RAM caching.
- Currently caching is set to 3000 [u], but only 2000*u+2 numbers are saved on GitHub. This means that performing operations like
nth korpsum n kwithk≤ 2000 from GitHub clone should be almost const time.k≤ 3000 will trigger full caching increasing the app startup time and enhancing largekcomputations.k> 3000 will trigger only in-RAM caching enhancing computations during one interactive session..
Contributing
Interested in contributing? We're always looking for help to improve documentation, fix issues, or make optimizations.
License
Distributed under the Apache License. See LICENSE for more information.
Author
Bernoulli was created by Tomasz Nehring, a creative mathematician and software engineer.
⚠️ Note: Not suitable for server use. Has many vulnerabilities. Can launch arbitrary code.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
