* Added solution for Project Euler problem 107
* Doctests and better variable names
* Type hints
* Small edits
* Forward reference for typing hint
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 59
* updating DIRECTORY.md
* Formatting, type hints, no more evil map functions
* Doctests
* Added doctests for Project Euler problem 59
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 085.
* updating DIRECTORY.md
* Minor tweaks to Project Euler problem 85
* Variable comments for project euler problem 85
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 180
* Fixed minor details in Project Euler problem 180
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 77.
* Update docstrings, doctest, type annotations and 0-padding in directory name. Reference: #3256
* Implemented lru_cache, better type hints, more doctests for problem 77
* updating DIRECTORY.md
* updating DIRECTORY.md
* Added solution for Project Euler problem 77. Fixes: 2695
* Update docstrings, doctest, type annotations and 0-padding in directory name. Reference: #3256
* Implemented lru_cache, better type hints, more doctests for problem 77
* better variable names
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* add solution for euler problem 89
* updates to accommodate euler solution guideline updates
* use more descriptive vars
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 129.
* Added doctest for solution() in project_euler/problem_129/sol1.py
* Update formatting. Reference: #3256
* More descriptive function and variable names, more doctests.
* Project Euler problem 188 solution
* fix superscript notation
* split out modexpt() function, and rename parameters
* Add some more doctest, and add type hints
* Add some reference links
* Update docstrings and mark helper function private
* Fix doctests and remove/improve redundant comments
* fix as per style guide
* Add project euler problem 50
* Apply format changes
* Descriptive function/parameter name and type hints
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Name: Prime square remainders
Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and
let r be the remainder when (pn−1)^n + (pn+1)^n is divided by pn^2.
For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25.
The least value of n for which the remainder first exceeds 10^9 is 7037.
Find the least value of n for which the remainder first exceeds 10^10.
Reference: https://projecteuler.net/problem=123
reference: #2695
Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
* Added solution to Euler 64.
Added Python solution to Project Euler Problem 64.
Added a folder problem_064.
Added __init__.py file.
Added sol1.py file.
* Update sol1.py
Made formatting changes as mentioned by pre-commit
* Update sol1.py
Minor changes to variable naming and function calling as mentioned by @ruppysuppy
* Update sol1.py
Changes to function call as mentioned by @cclauss
* Added a solution for Project Euler Problem 203 (https://projecteuler.net/problem=203)
* Simplified loop that calculates the coefficients of the Pascal's Triangle. Changes based on review suggestion.
* Moved get_squared_primes_to_use function outside the get_squarefree function and fixed a failing doctest with the former.
* Added solution to Project Euler problem 301
* Added newline to end of file
* Fixed formatting and tests
* Changed lossCount to loss_count
* Fixed default parameter value for solution
* Removed helper function and modified print stmt
* Fixed code formatting
* Optimized solution from O(n^2) to O(1) constant time
* Update sol1.py
* add solution to Project Euler problem 206
* Add solution to Project Euler problem 205
* updating DIRECTORY.md
* updating DIRECTORY.md
* Revert "Add solution to Project Euler problem 205"
This reverts commit 64e3d36cab.
* Revert "add solution to Project Euler problem 206"
This reverts commit 53568cf4ef.
* add solution for project euler problem 207
* updating DIRECTORY.md
* add type hint for output of helper function
* Correct default parameter value in solution
* use descriptive variable names and remove problem solution from doctest Fixes: #2695
Co-authored-by: nico <esistegal-aber@gmx.de>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Fix style of the first ten solutions for Project Euler
- Unify the header docstring, and add reference URLs to wikipedia
or similar
- Fix docstrings to be properly multilined
- Add newlines where appropriate
- Add doctests where they were missing
- Remove doctests that test for the correct solution
- fix obvious spelling or grammar mistakes in comments and
exception messages
- Fix line endings to be UNIX. This makes two of the files seem
to have changed completely
- no functional changes in any of the solutions were done
(except for the spelling fixes mentioned above)
* Fix docstrings and main function as per Style Guide
* Added solution for Project Euler problem 38. Fixes: #2695
* Update docstring and 0-padding in directory name. Reference: #3256
* Renamed is_9_palindromic to is_9_pandigital.
* Changed just-in-case return value for solution() to None.
* Moved exmplanation to module-level docstring and deleted unnecessary import
* Add solution for Project Euler 65,
* Add URL to problem 65 and don't pass in parameter to solution()
* Remove solution() tests
* Add tests for solution(), add fstring and positional arg for solution
* Rename directory and problem number to 065
* Remove directory
* Move up explanation to module code block
* Move solution() below helper function, rename variables
* include solution for problem 57
* fix line to long errors
* update filenames and code to comply with new regulations
* more descriptive local variables
* Added solution for Project Euler problem 75.
* Added doctest for solution() in project_euler/problem_75/sol1.py
* Update docstring and 0-padding of directory name. Reference: #3256
* More descriptive variable names
* Moved solution explanation to module-level docstring
* Added solution for Project Euler problem 72.
* Update type annotations and 0-padding of the directory name. Reference: #3256
* Rename sol1.py to sol2.py
* Added newline at the end of sol2.py
* Revert sol1.py
* Added solution for Project Euler problem 74. Fixes: #2695
* Added doctest for solution() in project_euler/problem_74/sol1.py
* Update docstrings and 0-padding of directory name. Reference: #3256
* Rename all Project Euler directories:
Reason:
The change was done to maintain consistency throughout the directory
and to keep all directories in sorted order.
Due to the above change, some config files had to be modified:
'problem_22` -> `problem_022`
* Update scripts to pad zeroes in PE directories
* Update README.md for Project Euler
* Add link to solution template
* Add newlines for better separation
* Add __name__ == __main__ block in template
* Apply suggestions from code review
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Improve introduction part
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Add solution for Project Euler 62
* Add doctests and annotate function params and return values for get_digits()
* Add extra newline between functions to fix flake8 errors
* Add extra newlines between function names
* Add missing return type for solution()
* Remove parenthesis from if statement
* Remove parentheses from while loop
* Add to explanation and fix second Travis build
* Compress get_digits(), add tests for solution(), add fstring and positional arg for solution()
* Remove input param when calling solution()
* Remove test case for the answer
* Trying to time every solution
* Proposal 2 for timing PE solutions:
- Use pytest fixture along with --capture=no flag to print out the
top DURATIONS slowest solution at the end of the test sessions.
- Remove the print part and try ... except ... block from the test
function.
* Proposal 3 for timing PE solutions:
Completely changed the way I was performing the tests. Instead of
parametrizing the problem numbers and expected output, I will
parametrize the solution file path.
Steps:
- Collect all the solution file paths
- Convert the paths into a Python module
- Call solution on the module
- Assert the answer with the expected results
For assertion, it was needed to convert the JSON list object to
Python dictionary object which required changing the JSON file itself.
* Add type hints for variables
* Fix whitespace in single_qubit_measure