Number Theory
1. Divisibility & primes
- and give . Fundamental theorem: every is a product of primes in one way.
- Tests: by digit sums; by alternating digit sums; by the last two, three digits; by both.
- . Divisible by and means divisible by .
- Products of primes: -type equations force the factors to be or .
- Primes in a window: among consecutive integers above , at most are prime; of three numbers one is divisible by .
- Sums of consecutive integers: is such a sum (of at least two) iff is not a power of .
- is divisible by every prime , and by every number up to .
2. Euclidean algorithm & Diophantine equations
- . Bézout: has integer solutions; is solvable iff , and then , .
- Factor the equation: ; from .
- Pythagorean triples: primitive ones are with , odd.
- Bounding: for with , a large makes the left side too small.
- Rational points: lines through a known point of a conic meet it again at rational points.
3. Modular arithmetic
- iff ; congruences can be added and multiplied. has an inverse mod iff .
- Powers cycle: compute until it repeats (, mod powers of ).
- Linear combinations: to find from and , write it as a combination of them.
- Polynomials mod : check every residue .
- Same remainder: if leave the same remainder mod , then divides the differences.
4. Fermat, Euler, Wilson & CRT
- Fermat: for . Euler: for . Wilson: .
- CRT: , with has one solution mod ; with it is solvable iff , and then unique mod .
- Sums of powers: unless .
5. Arithmetic functions
- For : number of divisors , sum , .
- Product of the divisors: .
- Given the number of divisors: factor to list the exponent patterns ().
- Divisors by residue: divisors or of alternate, since .
- Multiplicative maps: if , then is multiplicative.
6. Bases & digits
- ; digit sum mod . A number has digits.
- Product of digits (compare with the leading term).
- Binary fractions: .
- Factorial base: every positive rational is uniquely with .
- Unknown digits ( divisible by ): use the divisibility tests one at a time.