top of page


Finding the 10,001st Prime Number - Project Euler Problem 7
Problem 7 asks: What is the 10,001st prime number? My approach uses a straightforward primality test with trial division up to the square root of each candidate number. Here's the complete Python solution: python import math def is_prime (n): if n < 2 : return False for i in range ( 2 , int (math.sqrt(n)) + 1 ): if n % i == 0 : return False return True prime_list = [] for i in range ( 0 , 999999 ):
Jan 71 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 15 - Lattice Paths
Problem: Starting in the top-left corner of a 20×20 grid, and only being able to move right and down, how many routes are there to the bottom-right corner? At first glance, this seems like a classic dynamic programming or pathfinding problem. But I took a different approach - let the computer explore small cases, then use pattern recognition to crack the larger problem. from itertools import permutations import math from math import factorial dictionary_x = {} list_x = [0, 1
Jan 52 min read


Project Euler #36: Double-Base Palindromes in Python 🔢
Problem: Find the sum of all numbers less than one million which are palindromic in both base 10 and base 2 (binary). Note that palindromic numbers can't include leading zeros in either base. My approach was straightforward - check every number up to 1,000,000: python double_base_palindromes = [] for i in range ( 0 , 1000000 ): y = list ( str (i)) y.reverse() x = '' .join(y) if int (x) == int (i): b = bin (i) b = b[ 2 :] c =
Dec 17, 20251 min read


Project Euler #30: Finding Numbers Equal to the Sum of Fifth Powers of Their Digits
Tackled another Project Euler challenge - this time finding all numbers that can be written as the sum of the fifth powers of their digits. The problem excludes 1 (as per the problem statement), and asks: which numbers equal the sum of their digits raised to the fifth power? For example: 4150 = 4⁵ + 1⁵ + 5⁵ + 0⁵ = 1024 + 1 + 3125 + 0 = 4150 My Python solution iterates through numbers up to 9,999,999, converts each to individual digits, calculates the sum of fifth powers, and
Dec 16, 20251 min read
bottom of page