Math Encyclopedia

Essential mathematical algorithms and efficiency logic.

Prime Number Check

Determines if a number is prime by checking divisors only up to √n (O(√n)).

Loading...

Factorial (n!)

Calculates the product of all positive integers up to n (O(n)).

Loading...

Greatest Common Divisor (GCD)

Finds the largest shared factor using the Euclidean Algorithm (O(log min(a,b))).

Loading...

Least Common Multiple (LCM)

Smallest number divisible by both inputs. Built on GCD: LCM(a,b) = |aƗb| / GCD(a,b).

Loading...

Fibonacci Sequence

Generates the nth Fibonacci number iteratively in O(n) time and O(1) space.

Loading...

Power/Exponents

Raises a base to an exponent. Fast exponentiation (O(log n)) handles large exponents efficiently.

Loading...