Python/project_euler
Mark Moretto 3d4172307f
project_euler/problem_47/sol1.py (#2150)
* Create __init__.py

* Initial commit

Not sure if this should be formatted differently.  I'm open to ideas!

* Completing testing/updates

Ran code through `black`, `flake8`, and `doctest`.  Added some type hints.

`doctest` is finicky on sets, so I had to sort and reformat as set to pass those tests.

* Update project_euler/problem_47/sol1.py

Nice.

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

* Update project_euler/problem_47/sol1.py

Looks good

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

* Update project_euler/problem_47/sol1.py

Okay, this should work.  Thank you for the reminder on map(), filter(), reduce().

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

* Update project_euler/problem_47/sol1.py

My IDE needs a spellchecker.  Or, lighter comment font.

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

* Update project_euler/problem_47/sol1.py

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

* Update project_euler/problem_47/sol1.py

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

* Update project_euler/problem_47/sol1.py

This means that `results = run(N)` should be updated to `results = run(n)`, correct?

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

* Update project_euler/problem_47/sol1.py

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

* Update project_euler/problem_47/sol1.py

Looks good!

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

* Update project_euler/problem_47/sol1.py

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

* Update project_euler/problem_47/sol1.py

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

* Update project_euler/problem_47/sol1.py

Works for me! I spent way too much time getting this to pass doctest, so any improvement is welcome.

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

* Update sol1.py

Added some suggested changes from the pull request:
* Updated tests outputs in `unique_prime_factors` function.
* Changed `@lru_cache(maxsize=5)` to `@lru_cache(maxsize=None)`
* Removed duplicate `return` line in `equality` function
* Changed `i` to `base` in run function.
* Added some commentary to `run()` function.
* Replaced `group = list(map(lambda x: base + x, [i for i in range(n)]))` with `group = [base + i for i in range(n)]`

* Update sol1.py

* Trailing whitespace

* Update sol1.py

* Update __init__.py

* Update sol1.py

* Update __init__.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-25 12:25:19 +02:00
..
problem_01 added solution 7 for problem_01 (#1416) 2019-10-22 09:31:17 +02:00
problem_02 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_03 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_04 contribution guidelines checks (#1787) 2020-03-04 13:40:28 +01:00
problem_05 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_06 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_07 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_08 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_09 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_10 Simplify code by dropping support for legacy Python (#1143) 2019-08-19 15:37:49 +02:00
problem_11 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_12 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_13 Travis CI: Add a flake8 test for unused imports (#1038) 2019-07-25 13:19:00 +05:30
problem_14 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_15 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_16 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_17 Added doctest and more explanation about Dijkstra execution. (#1014) 2019-07-17 01:09:53 +02:00
problem_18 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_19 Fixes for issue "Fix the LGTM issues #1024" (#1034) 2019-07-18 19:05:14 +02:00
problem_20 GitHub Action formats our code with psf/black (#1569) 2019-11-14 19:59:43 +01:00
problem_21 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_22 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_23 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_24 Added doctest and more explanation about Dijkstra execution. (#1014) 2019-07-17 01:09:53 +02:00
problem_25 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_26 Deal with maps (#1945) 2020-05-06 03:32:40 +02:00
problem_27 Fix indentation contains tabs (flake8 E101,W191) (#1573) 2019-11-15 23:05:00 -08:00
problem_28 Simplify code by dropping support for legacy Python (#1143) 2019-08-19 15:37:49 +02:00
problem_29 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_30 Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
problem_31 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_32 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_33 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_36 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_40 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_42 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_47 project_euler/problem_47/sol1.py (#2150) 2020-06-25 12:25:19 +02:00
problem_48 Simplify code by dropping support for legacy Python (#1143) 2019-08-19 15:37:49 +02:00
problem_52 Added doctest and more explanation about Dijkstra execution. (#1014) 2019-07-17 01:09:53 +02:00
problem_53 pyupgrade --py37-plus **/*.py (#1654) 2020-01-03 22:25:36 +08:00
problem_56 Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
problem_67 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
problem_76 Simplify code by dropping support for legacy Python (#1143) 2019-08-19 15:37:49 +02:00
problem_99 Wrap lines that go beyond GitHub Editor (#1925) 2020-05-01 23:36:35 +02:00
problem_234 Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
problem_551 Euler problem 551 sol 1: Reduce McCabe code complexity (#2141) 2020-06-22 14:16:12 +02:00
README.md fixed project eular readme (#1391) 2019-10-18 23:52:32 +02:00

ProjectEuler

Problems are taken from https://projecteuler.net/.

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Project Euler is ideal for mathematicians who are learning to code.

Here the efficiency of your code is also checked. I've tried to provide all the best possible solutions.

For description of the problem statements, kindly visit https://projecteuler.net/show=all