Project Euler
Project Euler (named after Leonhard Euler) is a website dedicated to a series of computational problems intended to be solved with computer programs.[1][2] The project attracts graduates and students interested in mathematics and computer programming. Since its creation in 2001 by Colin Hughes, Project Euler has gained notability and popularity worldwide.[3] It includes 929 problems as of March 31 2025,[4] with a new one added approximately every week.[5] Problems are of varying difficulty, but each is solvable in less than a minute of CPU time using an efficient algorithm on a modestly powered computer.[6] Features of the siteA forum specific to each question may be viewed after the user has correctly answered the given question.[6] Problems can be sorted on ID, number solved and difficulty. Participants can track their progress through achievement levels based on the number of problems solved. A new level is reached for every 25 problems solved. Special awards exist for solving special combinations of problems. For instance, there is an award for solving fifty prime numbered problems. A special "Eulerians" level exists to track achievement based on the fastest fifty solvers of recent problems so that newer members can compete without solving older problems.[7] Example problem and solutionsThe first Project Euler problem is Multiples of 3 and 5
It is a 5% rated problem, indicating it is one of the easiest on the site. The initial approach a beginner can come up with is a bruteforce attempt. Given the upper bound of 1000 in this case, a bruteforce is easily achievable for most current home computers. A Python code that solves it is presented below. def solve(limit):
total = 0
for i in range(limit):
if i % 3 == 0 or i % 5 == 0:
total += i
return total
print(solve(1000))
This solution has a Big O Notation of . A user could keep refining their solution for any given problem further. In this case, there exists a constant time solution for the problem. The inclusion-exclusion principle claims that if there are two finite sets , the number of elements in their union can be expressed as . This is a pretty popular combinatorics result. One can extend this result and express a relation for the sum of their elements, namely
Applying this to the problem, have denote the multiples of 3 up to and the multiples of 5 up to , the problem can be reduced to summing the multiples of 3, adding the sum of the multiples of 5, and subtracting the sum of the multiples of 15. For an arbitrarily selected , one can compute the multiples of up to via
Later problems progress (non-linearly) in difficulty, requiring more creative methodology and higher understanding of the mathematical principles behind the problems. Project Euler CommunityProject Euler fosters a community on its official website where members engage in discussion after entering the correct solution. Many also share their detailed approaches on external platforms such as GitHub and personal websites,[8][9] promoting collaborative learning and the development of even more creative solutions. See alsoReferences
External links |
Portal di Ensiklopedia Dunia