Module Funarith_zarith__.Prime_zarith

include Funarith.Prime.S with type Z.t = Z.t
module Z : Funarith.Int.FULL with type t = Z.t
type divisor = {
prime : Z.t;
power : int;
}
module Cache : sig ... end
val is_prime : ?⁠cache:Cache.t ‑> Z.t ‑> bool

Is the integer prime?

val prime_decomposition : ?⁠cache:Cache.t ‑> Z.t ‑> divisor list

Decompose the number into a product of power-of-primes. Cheap if cache=Some c and is_prime_cached c n was called before.

  • Parameter cache: if provided, store results in the cache.
  • Raises Invalid_argument: if the number is negative
val primes_leq : ?⁠cache:Cache.t ‑> Z.t ‑> Z.t Sequence.t

Sequence of prime numbers smaller than (or equal to) the given number.

  • Parameter cache: if Some c, use c for storing intermediate results