Concepts203

βˆ‘MathIntermediate

Euler's Totient Function

Euler's Totient Function Ο†(n) counts how many integers from 1 to n are coprime with n.

#euler totient#phi function#coprime count+12
βˆ‘MathIntermediate

Modular Arithmetic Basics

Modular arithmetic is arithmetic with wrap-around at a fixed modulus m, like numbers on a clock.

#modular arithmetic#mod#modulo c+++12
βˆ‘MathIntermediate

Modular Inverse

A modular inverse of a modulo m is a number a_inv such that a Γ— a_inv ≑ 1 (mod m).

#modular inverse#extended euclidean algorithm#fermats little theorem+12
βˆ‘MathIntermediate

Euler's Theorem

Euler’s Theorem says that if a and n are coprime, then a raised to the power Ο†(n) is congruent to 1 modulo n.

#euler totient#euler theorem#modular exponentiation+12
βˆ‘MathIntermediate

Fermat's Little Theorem

Fermat's Little Theorem says that for a prime p and integer a not divisible by p, a^{p-1} ≑ 1 (mod p).

#fermat's little theorem#modular inverse#binary exponentiation+11
βˆ‘MathIntermediate

Fast Exponentiation

Fast exponentiation (binary exponentiation) computes a^n using repeated squaring in O(log n) multiplications.

#binary exponentiation#fast power#modular exponentiation+11
βˆ‘MathIntermediate

Chinese Remainder Theorem

The Chinese Remainder Theorem (CRT) reconstructs an integer from its remainders modulo pairwise coprime moduli and guarantees a unique answer modulo the product.

#chinese remainder theorem#crt#modular arithmetic+12
βˆ‘MathIntermediate

Linear Sieve

The linear sieve builds all primes up to n in O(n) time by ensuring each composite is marked exactly once by its smallest prime factor (SPF).

#linear sieve#smallest prime factor#spf+12
βˆ‘MathIntermediate

Prime Factorization

Prime factorization expresses any integer greater than 1 as a product of primes raised to powers, uniquely up to ordering.

#prime factorization#trial division#spf sieve+12
βˆ‘MathIntermediate

Extended Euclidean Algorithm

The Extended Euclidean Algorithm finds integers x and y such that ax + by = gcd(a, b) while also computing gcd(a, b).

#extended euclidean algorithm#bezout coefficients#gcd+12
βˆ‘MathIntermediate

Sieve of Eratosthenes

The Sieve of Eratosthenes marks multiples of each prime to find all primes up to n in O(n log log n) time.

#sieve of eratosthenes#segmented sieve#linear sieve+11
βˆ‘MathIntermediate

GCD and Euclidean Algorithm

The greatest common divisor (gcd) of two integers is the largest integer that divides both without a remainder.

#gcd#euclidean algorithm#extended euclidean+12