All Algorithms implemented in Python the-algorithms.com/
Go to file
Shriyans Gandhi 3a4cc7e310
Hexagonal number sequence (#5640)
* Hexagonal number sequence 

A hexagonal number sequence is a sequence of figurate numbers where the nth hexagonal number hₙ is the number of distinct dots in a pattern of dots consisting of the outlines of regular hexagons with sides up to n dots, when the hexagons are overlaid so that they share one vertex.

This program returns the hexagonal number sequence of n length.

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update and rename hexagonalnumbers.py to hexagonal_numbers.py

* Length must be a positive integer

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-29 09:39:32 +02:00
.github Fix pull request template (#5633) 2021-10-27 19:18:21 +02:00
arithmetic_analysis Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
audio_filters Simple audio filters (#5230) 2021-10-23 23:19:25 +02:00
backtracking Correct grammar of comment in backtracking/hamiltonian_cycle.py (#4868) 2021-10-02 15:51:53 +02:00
bit_manipulation Fix typos in Sorts and Bit_manipulation (#4949) 2021-10-20 16:42:32 +08:00
blockchain Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
boolean_algebra [mypy] Fix type annotations for boolean_algebra/quine_mc_cluskey.py (#5489) 2021-10-22 17:45:19 +08:00
cellular_automata add implementation of Nagel and Schrekenberg algo (#5584) 2021-10-26 09:57:49 +02:00
ciphers Add decode function to base16.py (#5575) 2021-10-26 15:23:38 +02:00
compression [mypy] annotate compression (#5570) 2021-10-26 12:29:27 +02:00
computer_vision [mypy] annotate computer_vision (#5571) 2021-10-23 23:26:21 +02:00
conversions Added physical pressure units (#5613) 2021-10-26 19:55:41 +02:00
data_structures [mypy] Fix type annotations in wavelet_tree.py (#5641) 2021-10-28 22:53:02 +02:00
digital_image_processing Added morphological operations, fixes: #5197 (#5199) 2021-10-16 16:32:40 +02:00
divide_and_conquer Remove unnecessary branch (#4824) 2021-10-12 00:33:06 +08:00
dynamic_programming [mypy] Fix type annotations for dynamic programming (#4687) 2021-09-03 11:49:23 +02:00
electronics Add implementation of Coulomb's Law (#4897) 2021-10-22 11:52:39 +08:00
file_transfer [mypy] fix small folders (#4292) 2021-03-23 16:51:50 +01:00
financial Financial: principle -> principal (#5614) 2021-10-27 00:41:32 +08:00
fractals mandelbrot.py: Commenting out long running tests (#5558) 2021-10-23 18:15:30 +02:00
fuzzy_logic Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
genetic_algorithm Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
geodesy Fix imports for all namespace packages (#2506) 2020-09-28 23:41:04 +02:00
graphics New fractals folder (#4277) 2021-03-20 06:49:30 +01:00
graphs Add random graph generator (#5240) 2021-10-25 15:59:52 +08:00
greedy_methods Added Optimal Merge Pattern Algorithm (#5274) 2021-10-14 12:51:13 +02:00
hashes Implementation of SHA-256 using Python (#5532) 2021-10-23 15:20:52 +02:00
knapsack Rewrite parts of Vector and Matrix (#5362) 2021-10-27 11:48:43 +08:00
linear_algebra Rewrite parts of Vector and Matrix (#5362) 2021-10-27 11:48:43 +08:00
machine_learning Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
maths Hexagonal number sequence (#5640) 2021-10-29 09:39:32 +02:00
matrix Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
networking_flow Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
neural_network [mypy] fix small folders 2 (#4293) 2021-03-26 12:21:16 +01:00
other Delete other/date_to_weekday.py as a how-to-use, not an algorithm (#5591) 2021-10-29 09:22:57 +02:00
physics Add algorithm for N-body simulation - retry (#4298) 2021-04-04 13:23:48 +02:00
project_euler Add solution for Project Euler problem 67 (#5519) 2021-10-28 19:27:14 +02:00
quantum Approve functions used as default arguments (#4699) 2021-08-31 07:56:19 +02:00
scheduling Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
scripts Wavelet tree (#4267) 2021-06-08 22:49:33 +02:00
searches Update binary_search.py (#4856) 2021-10-27 12:25:48 +08:00
sorts fix: use += in sorts/recursive_mergesort_array.py (#5019) 2021-10-27 00:43:46 +08:00
strings Fix validate_initial_digits of credit_card_validator.py (#5600) 2021-10-26 14:32:34 +02:00
web_programming Get top 10 HN posts (#5604) 2021-10-26 15:13:23 +02:00
.coveragerc Add pytest-cov (#1578) 2019-11-17 19:37:58 +01:00
.gitattributes Create .gitattributes for Cross OS compatibility (#3410) 2020-10-17 07:25:25 +02: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
.pre-commit-config.yaml Add pyupgrade to pre-commit (#5638) 2021-10-28 16:45:59 +02:00
CONTRIBUTING.md Fixed grammatical errors in CONTRIBUTING.md (#5555) 2021-10-23 14:54:41 +02:00
DIRECTORY.md [mypy] Fix type annotation in euler_method.py (#5649) 2021-10-28 22:31:32 +02:00
LICENSE.md Update LICENSE.md (#4210) 2021-02-19 19:15:19 +01:00
mypy.ini Updated mypy.ini, removed ok folders that were excluded (#5331) 2021-10-15 23:57:41 +02:00
pytest.ini Move validate_solutions and add durations flag to pytest.ini (#3704) 2020-10-24 19:07:33 +05:30
README.md docs: renovate README (#4620) 2021-09-29 23:34:35 +05:30
requirements.txt Get top 10 HN posts (#5604) 2021-10-26 15:13:23 +02:00

The Algorithms - Python

Gitpod Ready-to-Code Contributions Welcome Donate Discord chat Gitter chat
GitHub Workflow Status LGTM pre-commit code style: black

All algorithms implemented in Python - for education

Implementations are for learning purposes only. As they may be less efficient than the implementations in the Python standard library, use them at your discretion.

Getting Started

Read through our Contribution Guidelines before you contribute.

Community Channels

We're on Discord and Gitter! Community channels are great for you to ask questions and get help. Please join us!

List of Algorithms

See our directory for easier navigation and better overview of the project.