Tags

GCD / LCM

GCD / LCM

1 lesson
1 problem
1 code snippet
1 question bank

gcd-lcm

Foundations

1 lesson

Number Theory Fundamentals

Free
Intermediate

60 min

1 prereq

Why are hash table sizes almost always prime? Why does the Euclidean algorithm for `gcd` run in `O(log(min(a, b)))` time despite using only subtraction or remainders? **Number Theory Fundamentals** is the branch of math that answers these questions and quietly powers a surprising amount of practical software, from hashing and cryptography to scheduling and competitive programming shortcuts. This lesson introduces the core building blocks. You will study **prime numbers** and how to test primality efficiently, the **divisibility** relation and quick rules for spotting divisors, **GCD** (greatest common divisor) and **LCM** (least common multiple) with the identity `lcm(a, b) = a * b / gcd(a, b)`, and the **Euclidean algorithm** for computing `gcd` in logarithmic time. You will also do **prime factorization** by trial division (`O(sqrt(n))`) and see how factorizations make divisor counting, simplification, and periodicity arguments straightforward. This lesson builds on **Discrete Mathematics Basics**, where you learned how to reason precisely about sets, relations, and logical claims. Number theory uses that same proof-style reasoning, but applied to the integers and their multiplicative structure. With primes, `gcd`, and factorization in your toolkit, you will be ready to take the premium step into **Modular Arithmetic**, where you will reuse all of these ideas to work with `mod`, modular inverses, and Fermat's Little Theorem.

Not Started

0%

Foundations
Intermediate
Free
Number Theory
GCD / LCM
Euclidean Algorithm
Mathematics
Fundamentals
Sieve of Eratosthenes
Prime Factorization

Practice Problems

1 problem

Max Points on a Line

Not Started
Hard

Given an array of points on a 2D plane, find the maximum number of points that lie on the same straight line.

Mathematics
Hash Map / Dictionary
Computational Geometry
Algorithms
Advanced
Number Theory
GCD / LCM

873

27