All Categories

Number Theory

Primes, divisibility, modular arithmetic

Euclidean Algorithm

Basic
gcd(a,b)=gcd(b,amodb)\gcd(a,b) = \gcd(b, a \bmod b)

Recursively finds the greatest common divisor.

View details

Modular Congruence

Basic
ab(modm)a \equiv b \pmod{m}

a and b have the same remainder when divided by m.

View details

Fermat's Little Theorem

Advanced
ap11(modp)a^{p-1} \equiv 1 \pmod{p}

Holds when p is prime and gcd(a,p)=1.

View details

Euler's Totient

Advanced
ϕ(n)=npn(11p)\phi(n) = n\prod_{p|n}\left(1 - \frac{1}{p}\right)

Counts integers up to n coprime to n.

View details

Prime Number Theorem

Advanced
π(x)xlnx\pi(x) \sim \frac{x}{\ln x}

Approximates the number of primes below x.

View details

LCM from GCD

Basic
lcm(a,b)=abgcd(a,b)\text{lcm}(a,b) = \frac{|a b|}{\gcd(a,b)}

Least common multiple via the greatest common divisor.

View details

Sum of First n Integers

Basic
k=1nk=n(n+1)2\sum_{k=1}^{n} k = \frac{n(n+1)}{2}

Closed form for the sum of the first n natural numbers.

View details

Sum of First n Squares

Intermediate
k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6}

Closed form for the sum of the first n squares.

View details

Divisibility Rule for 3

Basic
n divisible by 3    digit sum divisible by 3n \text{ divisible by } 3 \iff \text{digit sum divisible by } 3

A number is divisible by 3 if the sum of its digits is.

View details

Divisibility Rule for 9

Basic
n divisible by 9    digit sum divisible by 9n \text{ divisible by } 9 \iff \text{digit sum divisible by } 9

A number is divisible by 9 if the sum of its digits is.

View details

Even and Odd Numbers

Basic
n=2k  (even),n=2k+1  (odd)n = 2k \;(\text{even}), \quad n = 2k+1 \;(\text{odd})

Every integer is either even or odd.

View details

Sum of First n Cubes

Intermediate
k=1nk3=(n(n+1)2)2\sum_{k=1}^{n} k^3 = \left(\frac{n(n+1)}{2}\right)^2

The sum of the first n cubes equals the square of the sum.

View details

Number of Divisors

Advanced
d(n)=(ai+1)d(n) = \prod (a_i + 1)

Count of divisors from prime factorization exponents.

View details

Sum of Divisors

Advanced
σ(n)=piai+11pi1\sigma(n) = \prod \frac{p_i^{a_i+1}-1}{p_i - 1}

Sum of all divisors from prime factorization.

View details

Even Perfect Number

Advanced
N=2p1(2p1)N = 2^{p-1}(2^p - 1)

Euclid-Euler form of even perfect numbers.

View details

Mersenne Number

Intermediate
Mp=2p1M_p = 2^p - 1

Numbers one less than a power of two.

View details

Fermat Number

Advanced
Fn=22n+1F_n = 2^{2^n} + 1

Numbers of a special exponential form.

View details

Triangular Number

Basic
Tn=n(n+1)2T_n = \frac{n(n+1)}{2}

Sum of the first n natural numbers.

View details

Square Number

Basic
Sn=n2S_n = n^2

The nth perfect square.

View details

Pentagonal Number

Intermediate
Pn=n(3n1)2P_n = \frac{n(3n-1)}{2}

The nth pentagonal figurate number.

View details

Fibonacci Recurrence

Basic
Fn=Fn1+Fn2F_n = F_{n-1} + F_{n-2}

Each term is the sum of the two before it.

View details

Binet Formula

Advanced
Fn=φnψn5F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}}

Closed form for the nth Fibonacci number.

View details

Golden Ratio

Intermediate
φ=1+521.618\varphi = \frac{1+\sqrt{5}}{2} \approx 1.618

Ratio where the whole is to the larger as the larger is to the smaller.

View details

Collatz Step

Intermediate
n{n/2even3n+1oddn \to \begin{cases} n/2 & \text{even} \\ 3n+1 & \text{odd} \end{cases}

The rule of the famous unsolved Collatz conjecture.

View details

Wilson Theorem

Advanced
(p1)!1(modp)(p-1)! \equiv -1 \pmod{p}

A primality criterion for p.

View details