Concepts15

βš™οΈAlgorithmIntermediate

Modular Arithmetic Pitfalls

Modular arithmetic is about working with remainders, but programming languages often return negative remainders, so always normalize with (a % MOD + MOD) % MOD.

#modular arithmetic#modular inverse#fermats little theorem+12
βˆ‘MathAdvanced

Burnside's Lemma

Burnside's Lemma says the number of distinct objects up to a symmetry group equals the average number of objects fixed by each symmetry.

#burnside's lemma#cauchy-frobenius#polya enumeration+12
βˆ‘MathIntermediate

Lucas' Theorem

Lucas' Theorem lets you compute C(n, k) modulo a prime p by working digit-by-digit in base p.

#lucas theorem#binomial coefficient modulo p#prime power modulus+12
βˆ‘MathAdvanced

Discrete Logarithm

The discrete logarithm problem asks for x such that g^x ≑ h (mod p) in a multiplicative group modulo a prime p.

#discrete logarithm#baby-step giant-step#pollard rho dlp+12
βˆ‘MathIntermediate

Permutations and Combinations

Permutations count ordered selections, while combinations count unordered selections.

#permutations#combinations#binomial coefficient+12
βˆ‘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

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

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