Mathy
Mathy is a playground for experimenting with streamed arithmetic on very large integers. The core mathstream package keeps big numbers on disk and operates on them chunk by chunk, which lets you manipulate values that would be impractical to materialize in memory. Around that library live a handful of experiments, utilities, and tests that explore different ways to work with big-number data.
What's Here
mathstream/– Streaming big-int helpers (StreamNumber, arithmetic primitives, garbage collection utilities). Seemathstream/README.mdfor an in-depth guide.collatz_ui/+collatz.py– A curses dashboard that visualizes Collatz walks. The UI pushes work onto a background thread so the main loop can keep the interface responsive while mathstream evaluates each step.pi_finder/+find_my.py– Nilakantha-based π explorer with both CLI output and a curses dashboard powered by mathstream primitives.stupid.py– Experimental Collatz-based encoder/decoder that maps ASCII message chunks to Collatz seeds and replays the sequence to recover the text.seed_start.py– Utility for seedingstart.txtwith huge streamed additions sourced from randomness or deterministic sequences.tests/– Sample digit files used by the regression script intest.py.
Getting Started
python -m venv venv
source venv/bin/activate
pip install -e .
From there you can explore the components:
- Run the regression checks:
python test.py - Launch the Collatz dashboard:
python collatz.py - Stream π digits to the terminal:
python find_my.py --ui - Print a quick π approximation:
python find_my.py --digits 200 - Try the Collatz encoder prototype:
python stupid.py - Seed the running total file:
python seed_start.py --seed 100 --mode seq
All streamed results land in instance/log/. If you need a clean slate, call mathstream.clear_logs() or delete that directory between runs.
Experiments and Next Steps
- Streaming workers – The Collatz and π dashboards (
collatz_ui/app.py,pi_finder/ui/app.py) showcase background threads feeding long-running computations into a curses UI. - Collatz encoding –
stupid.pycurrently encodes a message by turning ASCII blocks into integers and treating the first block as the Collatz seed. Extending this to use the full sequence (or to target specific steps) is an open avenue for exploration. - More tests –
test.pycovers the primary mathstream operations. Add pytest cases or property tests undertests/as new behaviours land.
Pull requests are welcome—especially around new streamed operations, smarter Collatz decoding strategies, and additional high-volume math experiments.
Description
Languages
Python
100%