Posts tagged “math”
7 posts Subscribe by RSS
7 posts
Project Euler 7: The 10001st Prime with a Sieve of Eratosthenes That Doubles in Size
Finding the n-th prime when the sieve bound is unknown: start small and double. We derive the sieve from trial division, show why doubling costs only a constant factor, with C++17 and Python 3 code.
Project Euler 6: The Square of the Sum Minus the Sum of the Squares in O(1)
Square of the sum minus sum of squares for 1 to 100, loop-free via n(n + 1) / 2 and n(n + 1)(2n + 1) / 6, both derived by pairing and telescoping, plus integer-range notes and C++17/Python 3 code.
Project Euler 5: Building the Smallest Number Divisible by 1 to 20 from Least Common Multiples
Build the smallest number divisible by 1 to 20 by folding lcm(a, b) = a / gcd(a, b) × b with Euclid's algorithm, plus a correctness proof, overflow notes, and C++17 and Python 3 code.
Project Euler 4: Searching Products from the Top for the Largest Palindrome
Find the largest palindrome product of two 3-digit numbers by searching big products first and pruning, with a proof the pruning is safe, the link to 11, and C++17 and Python 3 code.
Project Euler 3: Finding the Largest Prime Factor by Dividing It Out
Find the largest prime factor of a 12-digit number by trial division. Covers why the leftover value is prime, the √n iteration bound, 64-bit integer range, and C++17 and Python 3 code.
Project Euler 2: Adding Only the Even Fibonacci Numbers
Prove every third Fibonacci term is even, derive the even-only recurrence E(k) = 4E(k−1) + E(k−2), and sum even terms up to four million, with C++17 and Python 3 code and a correctness proof.
Project Euler 1: Summing Multiples of 3 or 5 in O(1)
Add up every number below 1000 divisible by 3 or 5 without a loop, using inclusion–exclusion and the arithmetic series formula. C++17 and Python 3 code, a correctness proof and integer-range notes.
No posts match. Try another word.