#mathematics #maths #factorial #combinatorics

factorial

Convenient methods to compute the factorial, optionally checked

5 unstable releases

0.3.0 Nov 16, 2022
0.2.1 Dec 17, 2020
0.2.0 Dec 3, 2019
0.1.1 Jul 4, 2018
0.1.0 Jul 4, 2018

#220 in Math

Download history 216/week @ 2023-02-11 378/week @ 2023-02-18 221/week @ 2023-02-25 341/week @ 2023-03-04 148/week @ 2023-03-11 171/week @ 2023-03-18 98/week @ 2023-03-25 229/week @ 2023-04-01 159/week @ 2023-04-08 262/week @ 2023-04-15 220/week @ 2023-04-22 228/week @ 2023-04-29 181/week @ 2023-05-06 140/week @ 2023-05-13 164/week @ 2023-05-20 132/week @ 2023-05-27

641 downloads per month
Used in 15 crates (11 directly)

MIT license

14KB
354 lines

Compute the factorial

This crate provides some convenient and safe methods to compute the factorial with an efficient method. More precisely it uses the prime swing algorithm to compute the factorial. See this paper for more detail.

It can compute the factorial in $O(n (\log{n} \cdot \log{\log {n}})^2)$ operations of multiplication. The time complexity of this algorithm depends on the time complexity of the multiplication algorithm used.


lib.rs:

Compute the factorial

This crate provides some convenient and safe methods to compute the factorial and related functions the most naive way possible.

They are not necessarily the fastest versions: there are prime sieve methods that compute the factorial in O(n (log n loglog n)^2). Patches are welcome.

Dependencies

~800KB
~13K SLoC