mirror of
https://github.com/jlengrand/project_euler.git
synced 2026-03-10 08:41:20 +00:00
Update README.markdown
Adds information about how I solve problem. Puts too long solutions in bold.
This commit is contained in:
@@ -1,18 +1,23 @@
|
||||
#My solutions to Project Euler 's website
|
||||
# My solutions to Project Euler 's website
|
||||
|
||||
[Project Euler](http://projecteuler.net/) is a website containing lots of problems aiming at being solved.
|
||||
I play around with them in order to sharpen my algorithm skills.
|
||||
**[Project Euler](http://projecteuler.net/)** is a website containing lots of problems aiming at being solved.
|
||||
|
||||
This is always challenging to solve problems on paper and fantastic to come up with an algorithmic solution.
|
||||
This is always challenging to solve problems on paper, and fantastic to come up with an algorithmic solution.
|
||||
I use Python for its simplicity. Simple Python code is very similar to paper solution, and fast to implement.
|
||||
|
||||
Each script runs by itself and contains one of several functions that directly solve the function. Thus, running a script should give you the answer directly.
|
||||
Each script runs by itself and will directly pop the solution out.
|
||||
|
||||
The script are named as e_problemnumber_inc. The higher the inc, the finer my solution.
|
||||
The scripts are named as e_problemnumber_inc. The higher the inc, the finer the solution.
|
||||
|
||||
Here is a list of all already solved problems, with a one line explanation.
|
||||
Should be used in order to help future reuse of code :)
|
||||
|
||||
**Note :** I try to get my solutions within a one minute timeframe. What I want here is to solve problems, not get them running as fast as possible.
|
||||
So you may find some of the code here quite ugly. And this is the case :). Why optimize something that completely fits its purpose ? ;)
|
||||
|
||||
|
||||
## Problems solved
|
||||
|
||||
1 - Add all the natural numbers below one thousand that are multiples of 3 or 5. - 0.011 <br />
|
||||
2 - By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. - 0.011 <br />
|
||||
3 - Find the largest prime factor of a composite number. - < 1 sec <br />
|
||||
@@ -22,11 +27,11 @@ Should be used in order to help future reuse of code :)
|
||||
7 - Find the 10001st prime. - too long <br />
|
||||
8 - Discover the largest product of five consecutive digits in the 1000-digit number. - 0.045 <br />
|
||||
9 - Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000. (a^2 + b^2 = c^2) - 1.500 <br />
|
||||
10 - Calculate the sum of all the primes below two million. - too long <br />
|
||||
10 - Calculate the sum of all the primes below two million. - **too long** <br />
|
||||
11 - What is the greatest product of four adjacent numbers on the same straight line in the 20 by 20 grid? - 0.048 <br />
|
||||
12 - What is the value of the first triangle number to have over five hundred divisors? - too long <br />
|
||||
12 - What is the value of the first triangle number to have over five hundred divisors? - **too long** <br />
|
||||
13 - Find the first ten digits of the sum of one-hundred 50-digit numbers. - 0.012 <br />
|
||||
14 - Find the longest sequence using a starting number under one million. - too long <br />
|
||||
14 - Find the longest sequence using a starting number under one million. - **too long** <br />
|
||||
15 - Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner? - 0.012 <br />
|
||||
16 - What is the sum of the digits of the number 2^1000? - 0.012 <br />
|
||||
17 - How many letters would be needed to write all the numbers in words from 1 to 1000? - 0.012 <br />
|
||||
@@ -35,18 +40,18 @@ Should be used in order to help future reuse of code :)
|
||||
20 - Find the sum of digits in 100! - 0.031 <br />
|
||||
21 - Evaluate the sum of all amicable pairs under 10000. (d(a) = b, d(b) = a) - 9.100 <br />
|
||||
22 - What is the total of all the name scores in the file of first names? - 0.082 <br />
|
||||
23 - Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. - _too long_ <br />
|
||||
24 - What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? - too long <br />
|
||||
23 - Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. - **too long** <br />
|
||||
24 - What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? - **too long** <br />
|
||||
25 - What is the first term in the Fibonacci sequence to contain 1000 digits? - 0.741 <br />
|
||||
26 - Find the value of d < 1000 for which 1/d contains the longest recurring cycle. < 5 sec <br />
|
||||
27 - Find a quadratic formula that produces the maximum number of primes for consecutive values of n. - too long <br />
|
||||
27 - Find a quadratic formula that produces the maximum number of primes for consecutive values of n. - **too long** <br />
|
||||
28 - What is the sum of both diagonals in a 1001 by 1001 spiral? - < 1 sec <br />
|
||||
29 - How many distinct terms are in the sequence generated by ab for 2 a 100 and 2 b 100? - < 1 sec <br />
|
||||
30 - Find the sum of all the numbers that can be written as the sum of fifth powers of their digits. - < 3 sec <br />
|
||||
31 - Investigating combinations of English currency denominations. - < 1 sec <br />
|
||||
33 - Discover all the fractions with an unorthodox cancelling method. < 1 sec <br />
|
||||
34 - Find the sum of all numbers which are equal to the sum of the factorial of their digits. - 30 sec - 16 sec <br />
|
||||
35 - How many circular primes are there below one million? <br />
|
||||
35 - How many circular primes are there below one million? - **too long** <br />
|
||||
36 - Find the sum of all numbers less than one million, which are palindromic in base 10 and base 2. - 0.933 <br />
|
||||
37 - Find the sum of all eleven primes that are both truncatable from left to right and right to left. < 1 min <br />
|
||||
38 - What is the largest 1 to 9 pandigital that can be formed by multiplying a fixed number by 1, 2, 3, ... ? < 1 sec <br />
|
||||
@@ -60,13 +65,11 @@ Should be used in order to help future reuse of code :)
|
||||
53 - How many values of C(n,r), for 1 <= n <= 100, exceed one-million? - < 1 sec <br />
|
||||
67 - Using an efficient algorithm find the maximal sum in the triangle? - 0.027 <br />
|
||||
|
||||
**In progress: **
|
||||
## In progress:
|
||||
|
||||
43 - Find the sum of all pandigital numbers with an unusual sub-string divisibility property. <br />
|
||||
47 - Find the first four consecutive integers to have four distinct primes factors. <br />
|
||||
97 - Find the last ten digits of the non-Mersenne prime: 28433 × 2^7830457 + 1. <br />
|
||||
|
||||
**WARNING : Spoil inside for those who want to solve problems by themselves :)**
|
||||
97 - Find the last ten digits of the non-Mersenne prime: 28433 <EFBFBD> 2^7830457 + 1. <br />
|
||||
|
||||
## Contact
|
||||
|
||||
@@ -75,4 +78,4 @@ Feel free to mail me for any comment or request.
|
||||
|
||||
You can contact me at julien at lengrand dot fr, or on my [current website](http://www.lengrand.fr)
|
||||
|
||||
Last update : 5/6/2012
|
||||
Last update : 16/10/2012
|
||||
|
||||
Reference in New Issue
Block a user