This repo hosts my personal solutions to Project Euler questions and is intended to help with ideas after writing your own solutions.
- Solve the problem on your own
- Check if you got it right on the Project Euler website
- See if my solutions give you any ideas on how to optimize
- If you found a better way, send a pull request!
Note: My solutions are by no means optimized. They are a work in progress.
You can test any of the Python solutions. I would appreciate any help with testing in Java and/or C as well. To test all Python solutions, while in the python directory you can run
python3 tests.py
The output will look something like this:
Problem 001: 0 ms
Problem 002: 0 ms
Problem 003: 108 ms
Problem 004: 296 ms
Problem 005: 0 ms
...
Problem 071: 0 ms
Problem 073: 4131 ms
Total computation time: 85898 ms
67 problems solved
If you would like to only run specific tests, you can do so by running something like
# Separate each problem number with a space (no zero padding)
python3 tests.py 2 3 5 7
which will output
Problem 002: 0 ms
Problem 003: 111 ms
Problem 005: 0 ms
Problem 007: 13 ms
Total computation time: 134 ms
4 problems solved
If you would like to graph the execution times of the problems tested, you can add the -g
or --graph
argument.
# -g and --graph are equivalent
python3 tests.py 1 2 3 4 5 6 7 8 9 10 -g
In order to ensure the functions in utils.py are working as expected (without creating an official testing folder), doctests have been added to the docstrings. Adding the --doctest
option when running tests.py will run a verbose doctest on utils.py.
Problem # | Python | C | Java |
---|---|---|---|
001 | Solution - Alternate Solution | Solution | Solution |
002 | Solution | Solution | Solution |
003 | Solution | Solution | Solution |
004 | Solution | Solution | Solution |
005 | Solution | Solution | X |
006 | Solution | Solution | Solution |
007 | Solution | Solution | X |
008 | Solution | Solution | X |
009 | Solution | Solution | Solution |
010 | Solution | Solution | X |
011 | Solution | X | X |
012 | Solution | Solution | X |
013 | Solution | X | X |
014 | Solution | Solution | X |
015 | Solution | Solution | X |
016 | Solution | X | X |
017 | Solution | X | X |
018 | Solution | X | X |
019 | Solution - Alternate Solution | X | X |
020 | Solution | X | X |
021 | Solution | X | X |
022 | Solution | X | X |
023 | Solution | X | X |
024 | Solution | X | X |
025 | Solution | X | X |
026 | Solution | X | X |
027 | Solution | X | X |
028 | Solution | X | X |
029 | Solution | X | X |
030 | Solution | X | X |
031 | Solution | X | X |
032 | Solution | X | X |
033 | Solution | X | X |
034 | Solution | X | X |
035 | Solution | X | X |
036 | Solution | X | X |
037 | Solution | X | X |
038 | Solution | X | X |
039 | Solution | Solution | X |
040 | Solution | X | X |
041 | Solution | X | X |
042 | Solution | X | X |
043 | Solution | X | X |
044 | Solution | X | X |
045 | Solution | X | X |
046 | Solution | X | X |
047 | Solution | X | X |
048 | Solution | X | X |
049 | Solution | X | X |
050 | Solution | X | X |
051 | X | X | X |
052 | Solution | X | X |
053 | Solution | X | X |
054 | Solution | X | X |
055 | Solution | X | X |
056 | Solution | X | X |
057 | Solution | X | X |
058 | Solution | X | X |
059 | Solution | X | X |
060 | X | X | X |
061 | X | X | X |
062 | Solution | X | X |
063 | Solution | X | X |
064 | X | X | X |
065 | Solution | X | X |
066 | X | X | X |
067 | Solution | X | X |
068 | Solution | X | X |
069 | Solution | X | X |
070 | Solution | X | X |
071 | Solution | X | X |
072 | Solution | X | X |
073 | Solution | X | X |
074 | Solution | X | X |
075 | Solution | X | X |
... | X | X | X |
077 | Solution | X | X |
... | X | X | X |
080 | Solution | X | X |
081 | Solution | X | X |
... | X | X | X |
085 | Solution | X | X |
... | X | X | X |
087 | Solution | X | X |
... | X | X | X |
092 | Solution | X | X |
... | X | X | X |
097 | Solution | X | X |
... | X | X | X |
099 | Solution | X | X |
... | X | X | X |
493 | Solution | X | X |
... | X | X | X |