Level 1 · Foundations
Free Math and bits lessons
16 lessons, about 131 minutes in all. Each teaches one idea with a visual, then gives you one problem built for it. Read the lessons here, then create a free account to solve the problems and keep your progress.
Stage 0Digits and divisibility
- Peel off the last digitWalk through a number's digits with % 10 and // 10.6 min
- Build a number digit by digitReverse a number by pushing digits onto the end of a new one.7 min
- Divisors come in pairsCount divisors by checking only up to the square root.9 min
- Euclid's shortcutFind the greatest common divisor by taking remainders.8 min
Stage 1Primes and remainders
- Cross out the multiplesFind every prime below n at once with the sieve of Eratosthenes.10 min
- Square and halveCompute a huge power's remainder quickly by squaring.10 min
- Count the fivesCount the zeros at the end of n! without computing it.8 min
- Remainder digit by digitFind the remainder of a number too long to store, reading it as text.8 min
Stage 2Bits
- Read the last bit, shift it awayCount the 1s in a number's binary form with & 1 and >> 1.8 min
- One bit onTest for a power of two in one step with n & (n − 1).7 min
- Pairs cancel outFind the one value without a partner by XOR-ing everything together.8 min
- Cancel against what should be thereFind the missing number from 0 to n by XOR-ing the list with the full range.7 min
Stage 3Bit tricks
There’s more after this
These are the opening stages of Math and bits. The full path climbs on to harder problems and a mastery test. Create a free account and we’ll keep your place.
Start the full path free