* The black formatter is no longer beta
* pre-commit autoupdate
* pre-commit autoupdate
* Remove project_euler/problem_145 which is killing our CI tests
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Added solution for Project Euler problem 145
* Updated spelling of comments
Updated spelling inline with codespell
* Removed trailing whitespaces in comments
* Added default values.
* nr -> number
Co-authored-by: John Law <johnlaw.po@gmail.com>
* nr -> number
* Update sol1.py
* Update sol1.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Improve solution
* Uncomment code that has been commented due to slow execution affecting Travis
* Fix
* scikit-fuzzy is causing broken builds
* fuzz = None
* Update fuzzy_operations.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* New solution for Euler problem 67
A faster and memory efficient solution based on the template of sol1.py.
Modified the solution to be more memory efficient while reading and generating the array
and during the solution finding.
No conditions and straightforward logic.
* added return type hint
* Update project_euler/problem_067/sol2.py
Preferring comprehensions over map
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update sol2.py
Self explanatory variable names
* Updated sol2 to problem 067 in directory
* Update project_euler/problem_067/sol2.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_067/sol2.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fixed extra line
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added solution for probelm_686 of project_euler
* Changed documentation and formatting.
* Added ref link to optimization logic
* Update project_euler/problem_686/sol1.py
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* [mypy] fix type annotations for problem003/sol1 and problem003/sol3
* [mypy] fix type annotations for project euler problem007/sol2
* [mypy] fix type annotations for project euler problem008/sol2
* [mypy] fix type annotations for project euler problem009/sol1
* [mypy] fix type annotations for project euler problem014/sol1
* [mypy] fix type annotations for project euler problem 025/sol2
* [mypy] fix type annotations for project euler problem026/sol1.py
* [mypy] fix type annotations for project euler problem037/sol1
* [mypy] fix type annotations for project euler problem044/sol1
* [mypy] fix type annotations for project euler problem046/sol1
* [mypy] fix type annotations for project euler problem051/sol1
* [mypy] fix type annotations for project euler problem074/sol2
* [mypy] fix type annotations for project euler problem080/sol1
* [mypy] fix type annotations for project euler problem099/sol1
* [mypy] fix type annotations for project euler problem101/sol1
* [mypy] fix type annotations for project euler problem188/sol1
* [mypy] fix type annotations for project euler problem191/sol1
* [mypy] fix type annotations for project euler problem207/sol1
* [mypy] fix type annotations for project euler problem551/sol1
* 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
* Removed print error_msgs at the end of test:
This was done only to reduce the message clutter produced by 60
failing tests. As that is fixed, we can produce the traceback in
short form and allow pytest to print the captured error message
output at the end of test.
* Start validate_solutions script for Travis CI
I am separating out the solution testing and doctest as validating
the solutions for the current number of solutions present is
taking 2 minutes to run.
* Project Euler problem 191 solution
* Add type hints and reference links
* Address requested changes
- update documentation
- split out helper function but mark it with an underscore
- remove redundant comments or make them more explicit/helpful
* Address requested changes
Name: Digit power sum
Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284.
We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that a2 = 512 and a10 = 614656.
Find a30
Reference: https://projecteuler.net/problem=119
reference: #2695
Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
* adding solution to problem 80
* updating DIRECTORY.md
* fixing spell check
* updating sol as per comments
* Add reference link to the problem
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Add type hints and default args to problem 15
* Changes function's name to solution in problem 34
* Update sol1.py
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* add problem url. Add typehint, default value and doctest
* run black
* add project url. add solution function for problem 35
* add space between imports on problem 35
* Update sol1.py
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* added type hints and refactored the code a bit
* made output statement more explicit
* used f-strings and updated type hints
* modified solution function to return an integer solution
* updated docstring
* Update sol1.py
* Update sol2.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>