Skip to content

JNumberTools is an open-source Java library for solving complex problems in combinatorics and number theory. Whether you're a researcher, developer, or student, this library offers a comprehensive set of APIs to efficiently handle a wide range of mathematical tasks, from basic to advanced combinatorial computations

License

Notifications You must be signed in to change notification settings

deepeshpatel/jnumbertools

Repository files navigation

JNumberTools

JNumberTools

JNumberTools is an open-source Java library designed to provide powerful tools for solving complex problems in combinatorics and number theory.

JNumberTools allows you to tackle challenging combinatorics problems—such as permutations, combinations, conditional-cartesian-products, ranking, partitions, etc. for both academic and practical applications in fields like mathematics, cryptography, data analysis, number theory, and algorithm design.

Key Features:

  1. Versatile and efficient APIs for various combinatorics and number-theory operations.
  2. Ideal for educational, research, and real-world problem-solving in cryptography, computer science, puzzle-creation, and optimization.
  3. Optimized for both small-scale and large-scale problems, delivering high performance.

latest version

The latest release of the library is v3.0.0. It is available through The Maven Central Repository here. Add the following section to your pom.xml file.

<dependency>
    <groupId>io.github.deepeshpatel</groupId>
    <artifactId>jnumbertools</artifactId>
    <version>3.0.0</version>
</dependency>

Currently Available Algorithms

  1. Permutations: 23 different types of permutations

  2. Combinations: 15 different types of combinations

  3. Set/subset generations: 4 different types available

  4. Cartesian Product: 4 different types of product

  5. Ranking of permutations & combinations

    1. Ranking of unique permutation
    2. Ranking of k-permutation
    3. Ranking of repetitive permutation
    4. Ranking of unique combination
    5. Rank of repetitive combination : Coming soon
    6. Rank of multiset permutation : Coming soon
    7. Rank of multiset combination : Coming soon
  6. Number system algorithms related to combinatorics

    1. Factorial Number System aka Factoradic
    2. Permutation Number System aka Permutadic
    3. Combinatorial Number System aka Combinadic

5. Ranking of permutations & combinations

5.1 Ranking of unique permutation

Calculates the rank of a unique permutation starting from 0th For example, there are total 4!=24 permutations of [0,1,2,3] where the first permutation [0,1,2,3] has rank 0 and the last permutation [3,2,1,0] has the rank of 23

BigInteger rank = JNumberTools.rankOf().uniquePermutation(3,2,1,0);

5.2 Ranking of k-permutation

Calculates the rank of a k=permutation. For example if we select 5 elements out of 8 [0,1,2,3,4,5,6,7] then there are total 8C5 permutations out of which 1000th permutation is [8,4,6,2,0]

//will return 1000
BigInteger rank = JNumberTools.rankOf().kPermutation(8,4,6,2,0);

5.3 Ranking of repetitive permutation

Calculates the rank of repetitive permutation of

//1,0,0,1 is the 9th repeated permutation of two digits 0 and 1  
int elementCount = 2;
BigInteger result = JNumberTools.rankOf()
    .repeatedPermutation(elementCount, new Integer[]{1,0,0,1});

5.4 Ranking of combination

Calculates the rank of given combination. For example if we generate combination of 4 elements out of 8 in lex order, then 35th combination will be [1,2,3,4]. So given the input 8 and [1,2,3,4], the API returns 35, the rank of combination

BigInteger rank = JNumberTools.rankOf().uniqueCombination(8, 1,2,3,4);

About

JNumberTools is an open-source Java library for solving complex problems in combinatorics and number theory. Whether you're a researcher, developer, or student, this library offers a comprehensive set of APIs to efficiently handle a wide range of mathematical tasks, from basic to advanced combinatorial computations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published