https://github.com/astef/sparsenumerics
Numbers stored as the positions of 1's in their binary form, useful for math with power of 2 towers
https://github.com/astef/sparsenumerics
biginteger math numbers sparse
Last synced: 6 months ago
JSON representation
Numbers stored as the positions of 1's in their binary form, useful for math with power of 2 towers
- Host: GitHub
- URL: https://github.com/astef/sparsenumerics
- Owner: astef
- License: other
- Created: 2019-02-19T13:40:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-26T13:02:49.000Z (about 6 years ago)
- Last Synced: 2025-03-12T03:37:02.536Z (10 months ago)
- Topics: biginteger, math, numbers, sparse
- Language: C#
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://dev.azure.com/stefurishin/SparseNumerics/_build/latest?definitionId=2&branchName=master) [](https://www.nuget.org/packages/SparseNumerics/)
## `SparseInteger`
A value of this type represents a non-negative integer that can be very large (like those that occur as
numeric values of high power towers, much larger than those that can be represented by `BigInteger`
within feasible memory limits), subject to a condition that either:
- the number fits into `ulong` type verbatim
- the number of 1's in its binary form is a moderate number (such that an array of that size can be allocated), and each of the positions of 1's in its binary form is, recursively, a number that can be represented by `SparseInteger`.
Code originally taken from https://github.com/VladimirReshetnikov/Oeis.A002845