Skip to main content

Crate factorial_engine

Crate factorial_engine 

Source
Expand description

A high-performance engine for working with factorials symbolically.

Rather than computing n! directly (which overflows for even moderately sized n), this crate uses Legendre’s Formula to derive the prime factorization of n! — a symbolic representation such as 2^47 × 3^22 × 5^12 × ... — without ever materializing the enormous integer value itself. This makes the engine fast and immune to overflow.

The crate also provides a reverse_factorial function to invert the process: given a value, determine which n (if any) satisfies n! == value.

Structs§

FactorialEngine
An engine for computing the symbolic (prime-factorized) form of n!.
SymbolicFactorial
The prime factorization of n!, expressed as {prime: exponent} pairs.

Enums§

FactorialError
Errors that can occur while working with factorials.

Functions§

reverse_factorial
Finds the integer n such that n! == value, if one exists.