8 parts · 8 chapters
Discrete Maths for Programmers
The maths a computer science degree teaches first, taught through code you already write: conditions are logic, types are sets, recursion is induction, ids colliding is counting, dependency trees are graphs, and every checksum and cipher is number theory. Every number in the course was computed with a script you can rerun.
Eight parts: logic and proof; sets and functions; induction and recursion; counting (including the birthday bound: 100,000 random 32-bit ids collide with 68.8% probability); graphs; number theory with modular arithmetic, primes, gcd and the Luhn check; relations and orders; and recurrences with the master theorem.
logicBoolean algebra, implication, quantifiers, proof by contradiction.
setsSets, functions, injections, and types as sets.
inductionWhy recursion works, and how to prove a loop correct.
countingPermutations, combinations, pigeonhole, birthday bound.
graphsVertices, edges, paths, trees, cycles, colouring.
numbersModular arithmetic, primes, gcd: the base of cryptography.
00
Logic and Proof
Propositions in code
1 ch · ~8 min01Sets and Functions
Sets are types; functions are mappings
1 ch · ~8 min02Induction and Recursion
Proving recursion correct
1 ch · ~8 min03Counting
Count before you trust randomness
1 ch · ~8 min04Graphs
Graphs in code
1 ch · ~8 min05Number Theory: Modular Arithmetic and Primes
Remainders, gcd, exponents, checks
1 ch · ~8 min06Relations and Orders
Relations in code
1 ch · ~8 min07Recurrences
From code to recurrence to growth
1 ch · ~8 minFor programmers without a CS degreeNo prerequisites beyond programming; leads into DSA, Theory of Computation, Cryptography and Probability.