Page
Library
Module
Module type
Parameter
Class
Class type
Source
EulerSourceThis is a library for arithmetic algorithms, primarily developed to solve Project Euler problems, although it is of more general use.
Commonly useful functions not related to arithmetic.
Generic fast exponentiation. pow ~mult ~unit x n is unit composed n times to the right with x, provided that n is non‐negative. For example:
pow ~mult:(^) ~unit:"x" "y" 5yields "xyyyyy". Complexity: 𝒪(log(n)) calls to mult.
Memoizing fixpoint combinator. Example use:
let fib = memoized_fix@@fun fib n ->
if n < 2 then
1
else
fib (n-1) + fib (n-2)Solving diophantine equations, i.e. equations on integers.