Python/project_euler/problem_47/__init__.py
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

2 lines
1 B
Python