Commit Graph

277 Commits

Author SHA1 Message Date
Kunwar Preet Singh
26f2df7622
Add sol for P104 Project Euler (#5257)
* Hacktoberfest: added sol for P104 Project Euler

* bot requests resolved

* pre-commit

* Update sol.py

* Update sol.py

* remove trailing zeroes

* Update sol.py

* Update sol.py

* Update sol.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-02 22:12:18 +08:00
Vineet Rao
4bd5494992
Add solution to Problem 145 of Project Euler (#5464)
* Solution to Problem 145 of Project Euler

* Provided more descriptive filename

* Update sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-02 21:58:12 +08:00
Paulo S. G. Ferraz
1400cb86ff
Remove duplicate is_prime related functions (#5892)
* Fixes (#5434)

* Update ciphers.rabin_miller.py
         maths.miller_rabin.py

* Fixing ERROR maths/miller_rabin.py - ModuleNotFoundError and changing project_euler's isPrime to is_prime function names

* Update sol1.py

* fix: try to change to list

* fix pre-commit

* fix capital letters

* Update miller_rabin.py

* Update rabin_miller.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-04-09 01:40:45 +08:00
Christian Clauss
24d3cf8244
The black formatter is no longer beta (#5960)
* 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>
2022-01-30 20:29:54 +01:00
Carl-Henrik Åkeson
d6a1623448
Add solution for Project Euler problem 145 (#5173)
* 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>
2021-11-10 18:22:27 +08:00
Maxim Smolskiy
0b8d6d70ce
Add Project Euler problem 205 solution 1 (#5781)
* updating DIRECTORY.md

* Add solution

* updating DIRECTORY.md

* Fix

* Fix

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-09 22:25:29 +08:00
Maxim Smolskiy
1a43c92c77
Improve Project Euler problem 043 solution 1 (#5772)
* updating DIRECTORY.md

* Fix typo

* Improve solution

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-05 20:44:24 +01:00
Rohan R Bharadwaj
48960268a2
Improve Project Euler Problem 10 Sol-1 (#5773)
* Improve Project Euler Problem 10 Sol-1

* Name correction

* psf/black formatting

* More formatting
2021-11-05 20:43:52 +01:00
Maxim Smolskiy
729aaf6427
Improve Project Euler problem 014 solution 2 (#5744)
* 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>
2021-11-04 17:01:21 +01:00
Maxim Smolskiy
e835e96856
Improve Project Euler problem 014 solution 1 (#5747)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis

* Fix
2021-11-04 16:37:47 +01:00
Maxim Smolskiy
765be4581e
Improve Project Euler problem 012 solution 2 (#5760)
* Improve solution

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-03 21:32:10 +01:00
Maxim Smolskiy
37bc6bdebf
Replace Travis CI mentions with GitHub actions (#5751) 2021-11-02 22:28:09 +01:00
Leoriem-code
60ad32920d
fixed typo for codespell (#5753) 2021-11-02 22:17:57 +01:00
Maxim Smolskiy
dd19d8120d
Uncomment code that has been commented due to slow execution affecting Travis (#5745) 2021-11-02 14:07:07 +01:00
Maxim Smolskiy
71ba3a1ad9
Improve Project Euler problem 012 solution 1 (#5731)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis

* Retest
2021-11-01 07:27:19 +01:00
Simon
0f015fa034
Added solution for euler problem 493 (#5573)
* Added solution for problem 493

* fixed typo

* return result as string
2021-10-31 11:48:10 +01:00
Maxim Smolskiy
f92eac982d
Improve Project Euler problem 092 solution 1 (#5703)
* Fix typos

* Improve solution
2021-10-31 11:38:28 +01:00
Maxim Smolskiy
568425dfd1
Improve solution (#5705) 2021-10-31 11:37:46 +01:00
Maxim Smolskiy
965b1ff7df
Improve Project Euler problem 078 solution 1 (#5708)
* Add solution doctests

* Improve solution function
2021-10-31 11:36:53 +01:00
Maxim Smolskiy
e7565f8bfc
Improve Project Euler problem 070 solution 1 (#5166)
* Change has_same_digits doctest

* Improve has_same_digits function
2021-10-30 21:36:12 +02:00
Naveen Namani
11a15cc584
Add solution for Project Euler problem 67 (#5519)
* 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>
2021-10-28 19:27:14 +02:00
Prakhar Gurunani
329feb4928
Add Project Euler Problem 078 solution 01 (#5565)
* Create sol1.py

* updating DIRECTORY.md

* Create __init__.py

* Add docstring

* Reformat with black

* Fix flake8 issues

* Add EOL

* Fix formatting issues

* Add docstring

* Add func return type

* Change return type

* Remove test print statement

* Reformat code

* Fix return types

* Break loop

* Update doctest sol

* Update project_euler/problem_078/sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Added doctest and changed return type

* Add int()

* Fix flake8 issues

* Use argument instead of fixed constant

* Update sol1.py

* fix sol1.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-27 17:19:04 +08:00
Srishtik Bhandarkar
b4036b70f1
Add solution for probelm_686 of project_euler (#5480)
* 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>
2021-10-27 01:10:15 +08:00
Maxim Smolskiy
b55da04602
Improve Project Euler problem 058 solution 1 (#4782)
* Fix typo

* Improve solution

* Retest

* Replace n with number
2021-10-25 16:07:10 +08:00
Maxim Smolskiy
5f7bb3e9f7
Improve Project Euler problem 034 solution 1 (#5165) 2021-10-25 16:03:22 +08:00
Marcel Kuhmann
5772d0734b
fix dead link (#5572) 2021-10-24 18:44:15 +02:00
John Law
c0acfd46cb
Fix factorial issues (#5496)
* updating DIRECTORY.md

* pass integer to `math.factorial` in `project_euler/problem_015`

* remove duplicated factorial function

* updating DIRECTORY.md

* Update maths/factorial_iterative.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update factorial_iterative.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-21 15:06:32 +08:00
John Law
4bf2eedd3c
[mypy] fix mypy error in Project Euler Problem 092 solution 1 (#5357)
* fix mypy error

* updating DIRECTORY.md

* simplify code

* run black

* fix doc consistency

* Fix doc

* fix doc

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-17 08:07:45 +02:00
Srishtik Bhandarkar
7ef2e4d1d0
Add Project Euler Problem 092 (#5091)
* adde solution to problem 092

* added solution to problem 092

* fixed the pre-comit shebang issue
2021-10-17 01:08:41 +08:00
Joyce
bcfca67faa
[mypy] fix type annotations for all Project Euler problems (#4747)
* [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
2021-10-12 00:33:44 +08:00
Maxim Smolskiy
d654806eae
Improve Project Euler problem 112 solution 1 (#4808) 2021-10-06 22:11:50 +08:00
Maxim Smolskiy
629369a34f
Improve Project Euler problem 203 solution 1 (#4807) 2021-10-06 22:11:15 +08:00
Maxim Smolskiy
66a528b171
Improve Project Euler problem 014 solution 2 (#4752) 2021-09-24 02:55:18 +08:00
Maxim Smolskiy
a7b9e28bc3
Improve Project Euler problem 009 solution 1 (#4749)
* Improve solution

* Uncomment code that has been commented due to slow execution affecting Travis
2021-09-21 13:28:27 +02:00
Maxim Smolskiy
01d58562cc
Fix typos in Project Euler problem 034 solution 1 (#4748)
* Fix comment

* Fix output
2021-09-18 21:33:03 +02:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
fpringle
8c13a7786f
feat: add solution for Project Euler problem 144 (#4280)
* Added solution for Project Euler problem 144

* updating DIRECTORY.md

* Better variable names

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-07-08 14:05:10 +05:30
Elisha Hollander
e7e6cbfb8f
refactor: Remove "redefinition" of dict element (#4309) 2021-04-04 09:25:57 +05:30
fpringle
89a43c81e5
feat: Add solution for Project Euler Problem 121 (#4261)
* Added solution for Project Euler problem 121

* Updated typing for 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-20 11:29:48 +05:30
fpringle
ecf9b8164f
Added solution for Project Euler problem 109 (#4080)
* Added solution for Project Euler problem 109

* New subscriptable builtin types

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-06 18:59:52 +05:30
fpringle
80f5213df5
Add solution for Project Euler problem 107 (#4066)
* 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>
2020-12-28 13:21:02 +05:30
fpringle
0ccb213c11
Add solution for Project Euler problem 102 (#4051)
* Added solution for Project Euler problem 102

* Got rid of map functions

* Snake case variable names

* Type hints

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-23 23:18:19 +05:30
fpringle
2ff2ccbeec
Add solution for Project Euler problem 101 (#4033)
* Added solution for Project Euler problem 101

* Got rid of map functions

* updating DIRECTORY.md

* Better function/variable names

* Better variable names

* Type hints

* Doctest for nested function

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-22 17:32:31 +05:30
sharmapulkit04
00f22a9970
Add solution for Project Euler problem 135 (#4035) 2020-12-19 11:46:15 +05:30
fpringle
ae8a5f8675
Add solution for Project Euler problem 59 (#4031)
* 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>
2020-12-13 16:39:52 +05:30
fpringle
a6f6eb2649
Add solution for Project Euler problem 86 (#4025)
* Added solution for Project Euler problem 86

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-12-12 10:49:35 +05:30
fpringle
75759fae22
Add solution for Project Euler problem 085 (#4024)
* 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>
2020-12-10 18:48:17 +05:30
fpringle
b1801398ec
Add Project Euler Problem 180 (#4017)
* 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>
2020-12-09 16:44:51 +05:30
fpringle
1e1708b8a1
Added solution for Project Euler problem 77 (#3132)
* 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>
2020-11-27 21:38:14 +05:30
Cory Metcalfe
b55e132b80
Add solution for Project Euler: Problem 89 (#2948)
* 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>
2020-11-21 10:59:29 +05:30
fpringle
c938e7311f
Added solution for Project Euler problem 129. (#3113)
* 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.
2020-11-21 08:22:26 +05:30
Peter Yao
28d33f4b2d
Project Euler 70 Solution (#3041)
* Add solution for Project Euler 70, Fixes: #2695

* Remove parameter from solution()

* Add tests for all functions, add fstring and positional arg for solution()

* Rename directory to 070

* Move up explanation to module code block

* Move solution() below helper functions, rename variables

* Remove whitespace from defining min_numerator

* Add whitespace

* Improve type hints with typing.List

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-21 08:12:07 +05:30
Michael D
d0bc9e268d
Add solution for Project Euler problem 188 (#2880)
* 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
2020-11-21 07:37:47 +05:30
tacitvenom
83b8b3c141
Fixes: #3869: Optimize CI runtime of Project Euler's Problem 74's Solution 2 (#3893)
* Fixes: #3869: Optimize Project Euler's Problem 74's  Solution 2

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-20 09:44:08 +05:30
Simon Landry
686d837d3e
Add project euler problem 50 (#3016)
* Add project euler problem 50

* Apply format changes

* Descriptive function/parameter name and type hints

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-08 08:26:10 +05:30
Ravi Kandasamy Sundaram
c8db6a208b
Add solution for Project Euler problem 123 (#3072)
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>
2020-11-06 22:25:02 +05:30
Shikhar Rai
29d0fbb0e0
HACKTOBERFEST - Added solution to Euler 64. (#3706)
* 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
2020-11-03 08:48:14 +05:30
Fernando Benjamín PÉREZ MAURERA
ff00bfa0ab
Added a solution for Project Euler Problem 203 "Squarefree Binomial Coefficients" (#3513)
* 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.
2020-11-03 07:51:13 +05:30
Peter Yao
61cb921d87
Project Euler 206 Solution (#3829)
* Readd Project Euler 206 solution for issue #2695, dupe of pull request #3042

* Add PE 206 to directory

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-11-02 23:24:20 +05:30
GGn0
d8f573c0fb
Add solution to problem 74 (#3110)
* Add solution to problem 74

* Fix typo

* Edit unnecessary comment

* Rename folder, add default params in solution()

* Rename file to solve conflicts

* Fix doctests
2020-11-01 21:12:21 +08:00
Akash Kumar
d3ead53882
Added solution to Project Euler problem 301 (#3343)
* 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
2020-11-01 16:27:48 +05:30
PetitNigaud
99adac0eb1
Add first solution for Project Euler Problem 207 (#3522)
* 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>
2020-10-29 12:34:42 +05:30
fpringle
9971f981a1
Added solution for Project Euler problem 87. (#3141)
* Added solution for Project Euler problem 87. Fixes: #2695

* Update docstring and 0-padding in directory name. Reference: #3256
2020-10-29 12:19:33 +05:30
sharmapulkit04
e172a8b08b
Hacktoberfest: Added first solution to Project Euler problem 58 (#3599)
* Added solution to problem 58

* Update sol1.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-29 10:03:55 +08:00
John Law
a5aef147e9
Fix Project Euler Readme (#3754)
* Fix Project Euler Readme

* updating DIRECTORY.md

* Update CONTRIBUTING.md

* spacing

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-26 21:18:57 +05:30
Ayoub Chegraoui
3a191d9a7c
Add solution to Project Euler problem 81 (#3408)
* Add solution to problem 81 - project euler

* Update project_euler/problem_081/sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update project_euler/problem_081/sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-25 09:36:31 +05:30
Michael D
98e9d6bdb6
Fix style of the first ten solutions for Project Euler (#3242)
* 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
2020-10-25 08:53:16 +05:30
Dhruv Manilawala
b97529dd88
Move validate_solutions and add durations flag to pytest.ini (#3704)
* Move PE validate_solutions to scripts/ directory

* Update pytest.ini file with durations settings

* Remove codespell and autoblack workflow file

* Dependent changes to test config files

* Update pytest.ini
2020-10-24 19:07:33 +05:30
fpringle
409438d250
Add solution for Project Euler problem 38. (#3115)
* 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
2020-10-24 08:12:15 +05:30
Peter Yao
20260d2b9c
Add Project Euler 65 Solution (#3035)
* 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
2020-10-24 07:55:15 +05:30
Christian Clauss
9b95e4f662
Pyupgrade to python3.8 (#3616)
* Upgrade to Python 3.8 syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-21 12:46:14 +02:00
Benjamin Smith
58875674da
Project Euler 57 - Square root convergents (#3259)
* include solution for problem 57

* fix line to long errors

* update filenames and code to comply with new regulations

* more descriptive local variables
2020-10-16 21:17:35 +05:30
fpringle
9643d3060d
Add solution for Project Euler problem 75. (#3129)
* 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
2020-10-16 16:00:45 +05:30
fpringle
b74f3a8b48
Add solution for Project Euler problem 91. (#3144)
* Added solution for Project Euler problem 91. Reference: #2695

* Added doctest for solution() in project_euler/problem_91/sol1.py

* Update docstring and 0-padding in directory name. Reference: #3256

* Update sol1.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-16 15:44:06 +05:30
fpringle
b96e6c7075
Add solution for Project Euler problem 174. (#3078)
* Added solution for Project Euler problem 174. 

* Fixed import order and removed executable permission from sol1.py

* Update docstrings, doctests, and annotations. Reference: #3256

* Update docstring

* Update sol1.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-16 15:14:09 +05:30
fpringle
d8f5b31fab
Add solution for Project Euler problem 72 (#3122)
* 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
2020-10-16 15:12:51 +05:30
fpringle
316fc41d6d
Add solution for Project Euler problem 74. (#3125)
* 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
2020-10-16 00:28:15 +05:30
fpringle
9482f6a5a9
Add solution for Project Euler problem 173. (#3075)
* Added solution for Project Euler problemm problem 173. #2695

* Added docstring

* Update formatting, doctest and annotations. Reference: #3256
2020-10-15 15:36:40 +05:30
fpringle
a119005135
Add solution for Project Euler problem 113 (#3109)
* Added solution for Project Euler problem 113. #2695

* Updated formatting and doctests. Reference: #3256
2020-10-15 15:29:53 +05:30
Dhruv
44254cf112
Rename Project Euler directories and other dependent changes (#3300)
* 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
2020-10-15 12:43:28 +05:30
Dhruv
2d7e08ef83
Update README.md for Project Euler (#3256)
* 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>
2020-10-15 09:47:19 +05:30
Peter Yao
671ab1d863
Project Euler 62 Solution (#3029)
* 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
2020-10-15 09:13:39 +05:30
Dhruv
29b32d3553
Improve validate solutions script & fix pre-commit error (#3253)
* 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
2020-10-13 15:41:12 +05:30
Simon Landry
50d7ed8417
Add project euler problem 51 (#3018)
* Add project euler problem 51

* Apply review suggestions
2020-10-12 22:40:29 +05:30
Utkarsh Chaudhary
8f8d39d191
Add a solution to Project Euler 72 (#2940)
* Added Problem 72

* Removed args from solution()

* Incorporated the suggested changes
2020-10-12 19:46:15 +05:30
Kasper Primdal Lauritzen
b6b025f25a
Fix docstring for Euler problem 11, solution 1 (#3228)
Docstring must have been leftover from some FizzBuzz method.
Now it describes the actual code.
2020-10-12 19:44:45 +05:30
Kasper Primdal Lauritzen
7b60cea490
Fix docstring for Euler problem 11, solution 2 (#3227) 2020-10-12 16:58:46 +05:30
Dhruv
69f9283825
Start running validate_solutions script for Travis CI (#3215)
* 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.
2020-10-12 11:29:39 +05:30
sarthaka1310
d02f6bbfbd
Added solution to Project Euler 69 (#2934)
* Added solution to Project Euler 69

* Accept edits from code review

Co-authored-by: Dhruv <dhruvmanila@gmail.com>

* Added doctests

* Renaming and exception handling

* Apply suggestions from code review

Co-authored-by: Dhruv <dhruvmanila@gmail.com>

* Edited mistake.

Co-authored-by: formal-acc <sarthak.agrawal@research.iiit.ac.in>
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-11 23:38:30 +05:30
Simon Landry
60f9895685
Fixes: #3163 - Add new solution for problem 234 (#3177)
* Fixes: #3163 - Add new solution for problem 234

* Apply review suggestions
2020-10-11 23:16:16 +05:30
Michael D
f029fcef7b
Add solution for Project Euler problem 191 (#2875)
* 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
2020-10-11 17:59:27 +05:30
Ravi Kandasamy Sundaram
2b5b2c6304
Added solution for Project Euler problem 119 (#2931)
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>
2020-10-10 23:29:02 +05:30
Dhruv
501a2ff430
[Project Euler] Fix code style for multiple problems (#3094)
* Fix code style for Project Euler problems:

- 13, 17, 21
- Default args
- Type hints
- File path

* Fix code style for multiple problems

* Made suggested changes
2020-10-10 21:23:17 +05:30
Sandeep Gupta
c07b82fa63
Add Project Euler Problem 80 (#2885)
* 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>
2020-10-10 17:06:25 +05:30
Carlos Meza
927e14e7f2
Cleanup Project Euler Problem 01 (#2900)
* mv str statement into docstr

* rename var to avoid redefining builtin

* clean up module docstr
2020-10-10 11:03:00 +05:30
fpringle
c83e4b77c5
Added solution for Project Euler problem 125 (#3073)
* Added solution for Project Euler problem 125

* Fixed typos
2020-10-09 22:41:00 +05:30
fa1l
10fe9d9be4
Coding style improvements for project_euler problem 45 & 16 (#3087)
* improvements for project euler task 45

* fixed documentation

* update pe_16/sol1.py

* update pe_16/sol2.py

* revert solution changes for sol1

* revert solution changes for sol2

* remove trailing spaces in sol1

* Update sol1.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-09 12:09:44 +05:30
Juan José Torres
216a194e9a
[Project Euler] Fix code style for problems 15 and 34 (#3076)
* 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>
2020-10-09 08:46:55 +05:30
Nelson Stoik
1c0deb88ac
Coding style change for project_euler problem 36 and 35 (#3062)
* 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>
2020-10-09 08:35:13 +05:30
Suyash Gupta
a3bbcd5f88
[Project Euler] Added type hints and refactored the code for Problem 14 (#3047)
* 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>
2020-10-09 08:33:23 +05:30