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.

logic and proof · sets and functions · induction and recursion · counting · graphs · number theory · relations and orders · recurrencesbeginner → mid · engineers without a computer science degree
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.
For programmers without a CS degreeNo prerequisites beyond programming; leads into DSA, Theory of Computation, Cryptography and Probability.