An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![Build Status](https://dev.azure.com/stefurishin/SparseNumerics/_apis/build/status/SparseNumerics-CI?branchName=master)](https://dev.azure.com/stefurishin/SparseNumerics/_build/latest?definitionId=2&branchName=master) [![Nuget Package](https://img.shields.io/nuget/v/SparseNumerics.svg)](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