Skip to content

Latest commit

 

History

History
133 lines (95 loc) · 6.05 KB

README.md

File metadata and controls

133 lines (95 loc) · 6.05 KB

Algebra

Greatest Common Divisor

Greatest Common Divisor (GCD) is the largest number which is a divisor of all given numbers. We can compute GCD(a,b) in O(log(min(a,b))).

The two implementations are available. Binary GCD is a little bit more efficient than standard one by using only binary operations.

References in English

Challenges

Least Common Multiple

Least Common Multiple (LCM) is the smallest number which is a multiple of all given numbers. We can also compute LCM(a,b) in O(log(min(a,b))).

References in English

Challenges

Binary Exponentiation

Binary exponentiation is a way to calculate the n-th power of a in O(log(n)). The algorithm requires only O(log(n)) multiplications.

Binary Exponentiation | C++ code

References in English

Challenges

Prime Factorization

Prime Factorization or Integer Factorization is a way to break a number into a set of prime numbers. All numbers in the set multiply together to result in the original number.

References in English

Challenges

Binomial Coefficients

Binomial coefficients (n,k) are the number of ways to pick a set of k elements up from n different elements. The order of elements picked up is not taken into account.

References in English

References in Japanese

Combination with repetition

Number of combinations with repetition | Combination - Wikipedia

$$((n, k)) = (n + k - 1, k)$$ $$H(n,k) = C(n+k-1,k)$$

Combination with repetition

Challenges

Extended Euclidean Algorithm

Extended Euclidean Algorithm is a way to compute a integer solution (x,y) of ax + by = gcd(a,b). We can compute the solution in O(log(min(a,b))).

References in English

Challenges

Modular Multiplcative Inverse

A Modular Multiplicative Inverse of an integer a is an integer x such that the product ax is congruent to 1 in modulus m.

$$ax = 1 (mod m) x = a^{-1} (mod m)$$

References in English

Challenges