Project Euler: a Python (beginner friendly) approach to complex mathematical challenges

Project Euler: a Python (beginner friendly) approach to complex mathematical challenges

- 9 mins

Leonhard Euler (1707-1783) was, without any doubt, one of the greatest mathematicians of all time. He is absolutely the most prolific, writing over 900 publications of work in different science fields (number theory, graph theory, analysis, physics, astronomy…). Matter of fact, an active effort was made to avoid naming everything after Euler and several theorems are attributed to the first person to have proved them after him.

Knowing this, it’s no surprise that Euler has become an idol and a role model to any aspiring mathematician (or engineer, or physicist, or…). The Project Euler is one of many tributes that has been made dedicated to Euler, inicially created as a subsection of our colleages in mathschallenge (a brilliant website to learn and enjoy mathematics). The Project Euler is a combination of mathematical problems that exists to encourage, challenge, and develop the skills and enjoyment of anyone with an interest in the fascinating world of mathematics.

In this page you will find my personal solutions to the problems, using only Python. They have been part of my process trying to learn Python and so, code can be messy or not optimized (sorry in advance). Every solution comes with small explanations, so it can serve as a Python learning experience, just as it was for me. Also, problems relying on tricky or advanced mathematics have a brief theorical explanation too.

I strongly encourage you to try and solve the problems without looking at any solution. Even if at first sight a problem feels overwhelming, give it a try and come back a few days later. You will be surprised at all the things you are capable of doing and you will learn even more.

And just remember, if everything goes wrong, here you’ll find some help. :)

This project is still a work in progress. Make sure to come back frecuently for the lastest updates!


ID             Description / Title             Python Solution
1 Multiples of 3 and 5 Euler_001
2 Even Fibonacci numbers Euler_002
3 Largest prime factor Euler_003
4 Largest palindrome product Euler_004
5 Smallest multiple Euler_005
6 Sum square difference Euler_006
7 10001st prime Euler_007
8 Largest product in a series Euler_008
9 Special Pythagorean triplet Euler_009
10 Summation of primes Euler_010
11 Largest product in a grid Euler_011
12 Highly divisible triangular number Euler_012
13 Large sum Euler_013
14 Longest Collatz sequence Euler_014
15 Lattice paths Euler_015
16 Power digit sum Euler_016
17 Number letter counts Euler_017
18 Maximum path sum I  
19 Counting Sundays  
20 Factorial digit sum  
21 Amicable numbers  
22 Names scores  
23 Non-abundant sums  
24 Lexicographic permutations  
25 1000-digit Fibonacci number  
26 Reciprocal cycles  
27 Quadratic primes  
28 Number spiral diagonals  
29 Distinct powers  
30 Digit fifth powers  
31 Coin sums  
32 Pandigital products  
33 Digit cancelling fractions  
34 Digit factorials  
35 Circular primes  
36 Double-base palindromes  
37 Truncatable primes  
38 Pandigital multiples  
39 Integer right triangles  
40 Champernowne’s constant  
41 Pandigital prime  
42 Coded triangle numbers  
43 Sub-string divisibility  
44 Pentagon numbers  
45 Triangular, pentagonal, and hexagonal  
46 Goldbach’s other conjecture  
47 Distinct primes factors  
48 Self powers  
49 Prime permutations  
50 Consecutive prime sum  
51 Prime digit replacements  
52 Permuted multiples  
53 Combinatoric selections  
54 Poker hands  
55 Lychrel numbers  
56 Powerful digit sum  
57 Square root convergents  
58 Spiral primes  
59 XOR decryption  
60 Prime pair sets  
61 Cyclical figurate numbers  
62 Cubic permutations  
63 Powerful digit counts  
64 Odd period square roots  
65 Convergents of e  
66 Diophantine equation  
67 Maximum path sum II  
68 Magic 5-gon ring  
69 Totient maximum  
70 Totient permutation  
71 Ordered fractions  
72 Counting fractions  
73 Counting fractions in a range  
74 Digit factorial chains  
75 Singular integer right triangles  
76 Counting summations  
77 Prime summations  
78 Coin partitions  
79 Passcode derivation  
80 Square root digital expansion  
81 Path sum: two ways  
82 Path sum: three ways  
83 Path sum: four ways  
84 Monopoly odds  
85 Counting rectangles  
86 Cuboid route  
87 Prime power triples  
88 Product-sum numbers  
89 Roman numerals  
90 Cube digit pairs  
91 Right triangles with integer coordinates  
92 Square digit chains  
93 Arithmetic expressions  
94 Almost equilateral triangles  
95 Amicable chains  
96 Su Doku  
97 Large non-Mersenne prime  
98 Anagramic squares  
99 Largest exponential  
100 Arranged probability  

Thank you for your time and attention. Feel free to reach out if you have any questions or inquiries. I’d love to hear from you!

David Boo

David Boo

Where biology, informatics & statistics intersect

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora