All Algorithms implemented in Python the-algorithms.com/
Go to file
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
.github Errors notifications under pull requests (#2081) 2020-06-08 14:11:01 +02:00
arithmetic_analysis Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
backtracking Euler problem 551 sol 1: Reduce McCabe code complexity (#2141) 2020-06-22 14:16:12 +02:00
bit_manipulation Create Python/bit_manipulation/README.md (#1897) 2020-04-20 20:19:27 +02:00
blockchain Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
boolean_algebra Tabs --> spaces in quine_mc_cluskey.py (#1426) 2019-11-21 22:21:40 +08:00
cellular_automata Blacken one_dimensional.py (#1911) 2020-04-27 18:40:46 +02:00
ciphers Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
compression Add lempel ziv compression (#2107) 2020-06-17 21:12:48 +02:00
computer_vision Added Readme for computer vision (#2075) 2020-06-10 17:10:47 +02:00
conversions Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
data_structures Update avl_tree.py (#2145) 2020-06-25 09:55:13 +02:00
digital_image_processing Create change_brightness.py (#2126) 2020-06-17 07:49:20 +02:00
divide_and_conquer Fix long line, tests (#2123) 2020-06-16 14:29:13 +02:00
dynamic_programming Euler problem 551 sol 1: Reduce McCabe code complexity (#2141) 2020-06-22 14:16:12 +02:00
file_transfer Create codespell.yml (#1698) 2020-01-18 13:24:33 +01:00
fuzzy_logic Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
geodesy Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
graphics Added implementation for Bezier Curve, under a new graphics directory. (#1713) 2020-01-25 07:18:43 +01:00
graphs Strongly connected components (#2114) 2020-06-17 18:16:54 +02:00
greedy_method calc_profit always returns an int (#2090) 2020-06-11 16:36:09 +02:00
hashes hamming_code.py: Reduce McCabe code complexity (#2140) 2020-06-22 14:18:57 +02:00
images Add Travis_CI_tests_are_failing.md (#1499) 2019-10-28 13:38:08 +01:00
linear_algebra Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
machine_learning NLP Word Frequency Algorithms (#2142) 2020-06-25 10:00:43 +02:00
maths Blacken our code (#2125) 2020-06-17 06:59:38 +08:00
matrix Count (#2084) 2020-06-16 14:36:09 +02:00
networking_flow Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
neural_network Test the exception conditions (#1853) 2020-04-13 02:10:21 +02:00
optimization added hill climbing algorithm (#1666) 2020-01-08 06:00:55 +01:00
other Added LFU Cache (#2151) 2020-06-25 11:40:50 +02:00
project_euler project_euler/problem_47/sol1.py (#2150) 2020-06-25 12:25:19 +02:00
quantum Update README.md (#1842) 2020-04-07 23:56:21 +02:00
scheduling Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
scripts Update build_directory_md.py (#2066) 2020-06-02 21:14:12 +02:00
searches Fix long line, tests (#2123) 2020-06-16 14:29:13 +02:00
sorts Typehints + refactor (#2154) 2020-06-25 09:48:52 +02:00
strings Implement prefix function, knuth-morris-pratt another usage (#2099) 2020-06-17 18:27:05 +02:00
traversals Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
web_programming fix fetch_github_info __main__ bug (#2080) 2020-06-11 16:38:43 +02:00
.coveragerc Add pytest-cov (#1578) 2019-11-17 19:37:58 +01:00
.gitignore contribution guidelines checks (#1787) 2020-03-04 13:40:28 +01:00
.gitpod.yml Change gitpod configuration for python3. (#1827) 2020-04-07 12:20:08 +02:00
.travis.yml Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
CONTRIBUTING.md CONTRIBUTING.md: Update flake8 command (#2124) 2020-06-16 16:33:17 +02:00
DIRECTORY.md Add doctests to radix_sort() (#2148) 2020-06-23 15:37:24 +02:00
LICENSE.md Update year in LICENSE.md (#1848) 2020-04-13 02:17:29 +02:00
natural_language_processing Create natural_language_processing (#2116) 2020-06-15 09:55:41 +02:00
pytest.ini Add pytest init file to define custom mark mat_ops (#2120) 2020-06-15 18:09:32 +02:00
README.md Fix psf/black issues than fail the build (#1935) 2020-05-03 23:58:44 +02:00
requirements.txt Added Lstm example for stock predection (#1908) 2020-05-07 08:53:44 +02:00
Travis_CI_tests_are_failing.md Add Travis_CI_tests_are_failing.md (#1499) 2019-10-28 13:38:08 +01:00

The Algorithms - Python

Gitpod Ready-to-Code Gitter chat  Build Status  LGTM  contributions welcome  Donate   

All algorithms implemented in Python (for education)

These implementations are for learning purposes. They may be less efficient than the implementations in the Python standard library.

Contribution Guidelines

Read our Contribution Guidelines before you contribute.

Community Channel

We're on Gitter! Please join us.

List of Algorithms

See our directory.