top of page


Finding the Pythagorean Triplet: Project Euler Problem 9
The Challenge Project Euler Problem 9 asks us to find the unique Pythagorean triplet where a + b + c = 1000, then calculate the product abc. A Pythagorean triplet consists of three natural numbers a, b, c where: a² + b² = c² The classic example being 3² + 4² = 5² (9 + 16 = 25) The Brute Force Approach The solution above takes a straightforward nested loop approach: python import math for a in range ( 0 , 1000 ): for b in range ( 0 , 1000 ): for c in range
Jan 71 min read


Finding the Largest Product in a Series: Project Euler Problem 8
Project Euler Problem 8 asks us to find the thirteen adjacent digits in a 1000-digit number that have the greatest product. It's a straightforward problem that tests our ability to work with strings, iteration, and basic arithmetic operations. The Problem Given a 1000-digit number, we need to: Extract every possible sequence of 13 consecutive digits Calculate the product of each sequence Return the maximum product found The Solution Here's my Python solution: python products
Jan 72 min read


Project Euler Problem 6: Sum Square Difference in Python
Found the difference between the sum of squares and the square of sums for the first 100 natural numbers. The problem: Calculate (1² + 2² + ... + 100²) vs (1 + 2 + ... + 100)² python sum_of_squares = [] sum_of_numbers = [] for i in range ( 0 , 101 ): sum_of_squares.append(i * i) sum_of_numbers.append(i) ss = sum (sum_of_squares) sn = sum (sum_of_numbers) sn2 = sn * sn print ( abs (ss - sn2)) Result: 25,164,150 The mathematical elegance here is that while bo
Jan 71 min read


Project Euler Problem 5 - Smallest positive number that is evenly divisible by the numbers 1-20
Finding the Smallest Multiple Using Python Project Euler Problem 5 asks us to find the smallest positive number that is evenly divisible by all numbers from 1 to 20. Let's solve it with Python. The Problem We need to find the smallest number that can be divided by each of the numbers from 1 to 20 without any remainder. For example, 2520 is the smallest number divisible by all numbers from 1 to 10. The Solution python for i in range ( 0 , 300000000 ): if i % 2 != 0
Jan 62 min read
bottom of page