Commit Graph

369 Commits

Author SHA1 Message Date
Tianyi Zheng
b72d0681ec
Remove extra imports in gamma.py doctests (#8060)
* Refactor bottom-up function to be class method

* Add type hints

* Update convolve function namespace

* Remove depreciated np.float

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Renamed function for consistency

* updating DIRECTORY.md

* Remove extra imports in gamma.py doctests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-12-29 18:06:26 +01:00
Aaryan Raj
b25915adf9
Add algorithm to convert decimal number to its simplest fraction form (#8001)
* Added algorithm to convert decimal number to its simplest fraction form

* Apply suggested changes
2022-12-11 08:04:04 +01:00
Akshay Dubey
5654c6242e
algorithm: Hexagonal number (#8003)
* feat: Add hexagonal number

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-29 19:29:21 +01:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Akshay Dubey
b33ea81a74
algorithm: Add juggler sequence (#7985)
* feat: Add juggler sequence

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Remove temp variable

* refactor: Change error type for negative numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

* refactor: Remove int typecasting

* test: Add unit tests for n=10 and n=25

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-18 09:18:47 +01:00
Akshay Dubey
4ce8ad9ce6
algorithm: Liouville lambda function (#7986)
* feat: Add liouville lambda function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Refactor if-else block

* refactor: Refactor error handling for -ve numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-15 18:28:49 +01:00
Akshay Dubey
e1be882f72
algorithm: Twin prime (#7980)
* feat: Add twin prime algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: Fix broken import statement

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 11:55:50 +01:00
Christian Clauss
5c92b7390e
prime_numbers.py: Tighten up the benchmarks (#7976)
* prime_numbers.py: Tighten up the benchmarks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-10 15:42:14 +13:00
Akshay Dubey
076193eefa
feat: Add pronic number implementation (#7979)
* feat: Add pronic number implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 15:39:47 +13:00
Akshay Dubey
3f9aae149d
feat: Add automorphic number implementation (#7978)
* feat: Add automorphic number implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Add type checking for number

* refactor: Rename variable n to number

* test: Add doctest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test: Add unit  test for number=0

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-09 16:36:38 +01:00
Christian Clauss
6aaf0a2c77
maths/number_of_digits.py: Streamline benchmarks (#7913)
* maths/number_of_digits.py: Streamline benchmarks

```
num_digits(262144): 6 -- 0.2226011250168085 seconds
num_digits_fast(262144): 6 -- 0.13145116699161008 seconds
num_digits_faster(262144): 6 -- 0.09273383300751448 seconds

num_digits(1125899906842624): 16 -- 0.6056742920191027 seconds
num_digits_fast(1125899906842624): 16 -- 0.15698366600554436 seconds
num_digits_faster(1125899906842624): 16 -- 0.1027024170034565 seconds

num_digits(1267650600228229401496703205376): 31 -- 1.1957934170495719 seconds
num_digits_fast(1267650600228229401496703205376): 31 -- 0.15552304196171463 seconds
num_digits_faster(1267650600228229401496703205376): 31 -- 0.13062308297958225 seconds
```

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update number_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-08 11:49:47 +00:00
Caeden Perelli-Harris
daa1c7529a
Raise error not string (#7945)
* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

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

* feat: Apply `__repr__` changes

* chore: Fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/segment_tree_other.py

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

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-06 15:54:44 +01:00
Sanders Lin
51708530b6
Update 3n_plus_1.py (#7966)
* Update 3n_plus_1.py

1. Minor issue with ValueError message: Given integer should be positive, not greater than 1, as 1 is allowed.
2. += calls underlying list extend method which might be slower. Calling apend seems more appropriate.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-06 10:35:40 +01:00
Christian Clauss
d23e709aea
maths/sum_of_digits.py: Streamline benchmarks (#7914)
* maths/sum_of_digits.py: Streamline benchmarks

```
sum_of_digits(262144): 19 -- 0.3128329170285724 seconds
sum_of_digits_recursion(262144): 19 -- 0.34008108399575576 seconds
sum_of_digits_compact(262144): 19 -- 0.6086010000435635 seconds

sum_of_digits(1125899906842624): 76 -- 0.8079068749793805 seconds
sum_of_digits_recursion(1125899906842624): 76 -- 0.8435653329943307 seconds
sum_of_digits_compact(1125899906842624): 76 -- 1.247976207989268 seconds

sum_of_digits(1267650600228229401496703205376): 115 -- 1.6441589999594726 seconds
sum_of_digits_recursion(1267650600228229401496703205376): 115 -- 1.713684624992311 seconds
sum_of_digits_compact(1267650600228229401496703205376): 115 -- 2.2197747920290567 seconds
```

* updating DIRECTORY.md

* Update sum_of_digits.py

* Update sum_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-01 14:07:11 +01:00
Caeden Perelli-Harris
7d139ee7f1
refactor(abs): Condense abs_min and abs_max (#7881)
* refactor(abs): Condense `abs_min` and `abs_max`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 07:50:43 +01:00
Paradact
7addbccee7
Torus volume (#7905)
* Added Torus volume algorithm

* Updated Torus volume for simplicity (removed ref to vol_sphere())

* Refactoring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 10:51:45 +13:00
Paradact
6c15f526e5
Added Torus surface area (#7906)
* Added Torus surface area

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed error in test

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 10:50:50 +13:00
Shriyans Gandhi
ded5deabe9
Dodecahedron surface area and volume (#6606)
* 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

* Create dodecahedron.py

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* Update dodecahedron.py

* Apply suggestions from code review

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* Update dodecahedron.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
2022-10-31 18:15:37 +01:00
himanshit0304
f8958ebe20
Add print_multiplication_table.py (#6607)
* Add print_multiplication_table.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added return type description

* Update print_multiplication_table.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 23:55:11 +01:00
kumarsurajsk
2c65597093
addition_without_arithmetic (#6830)
* Addition_without_arithmetic

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added_param

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added_param_in_first_sec

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change_align

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update Addition_without_arithmetic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename Addition_without_arithmetic.py to addition_without_arithmetic.py

* Update addition_without_arithmetic.py

* Update addition_without_arithmetic.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 13:52:37 +01:00
Lukas Esc
cafbbab125
shortened code using abs() and inplace ops (#7191)
n = -n if n < 0 else n --> n = abs(n)
n = n // 10 --> n //= 10
2022-10-30 11:56:54 +01:00
Emmanuel Bauma Murairi
b5d7f186f4
Polynomial (#6745)
* implement function to handle polynomial operations

* edit documentation

* fix type hint and linter errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix short variable name

* fix spelling

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 11:52:50 +01:00
happiestbee
00fc53de97
added sumset.py Fixes: #{6563} (#6742)
* Create sumset.py

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add descriptive var names

* Update maths/sumset.py

Co-authored-by: Caeden <caedenperelliharris@gmail.com>

* Update sumset.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:49:05 +01:00
Carlos Villar
17d93cab78
Added Manhattan distance algorithm (#7790)
* Added Manhattan distance algorithm, Fixes: #7776

* Forgot that isinstance can accept a tuple

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manhattan_distance.py

* Update manhattan_distance.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 10:00:47 +01:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Kuldeep Borkar
3a671b57a2
Implemented Swish Function (#7357)
* Implemented Swish Function

* Added more description and return hint in def

* Changed the name and added more descrition including test for sigmoid function

* Added * in front of links
2022-10-28 16:27:16 +02:00
Caeden Perelli-Harris
61eedc16c3
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Alexandre Velloso
501a1cf0c7
Remove unnecessary else statement (#7759)
* Remove unnecessary else statement

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:51:14 +02:00
Matteo Messmer
71e8ed81ae
Added spheres union (#6879)
* Spheres union

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update volume.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update volume.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* f-strings

* Update maths/volume.py

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

* more tests

* fix non negative

* fix 0 radius

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix tests

* fix print

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix comment

* fix comment

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update volume.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-27 19:45:58 +02:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Mislah
505c5e20fa
Included area of n sided regular polygon (#7438)
* Included area of n sided regular polygon 

Added a function to calculate the area of n sided regular polygons

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* code standard fixes as per PR comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-26 00:26:05 +02:00
Tianyi Zheng
d25187eb7f
Remove type cast in combinations algorithm (#7607)
* Remove commented-out print statements in algorithmic functions

* Encapsulate non-algorithmic code in __main__

* Remove unused print_matrix function

* Remove print statement in __init__

* Remove print statement from doctest

* Encapsulate non-algorithmic code in __main__

* Modify algorithm to return instead of print

* Encapsulate non-algorithmic code in __main__

* Refactor data_safety_checker to return instead of print

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updating DIRECTORY.md

* Remove int cast and change float division to int division

* Move new-line chars

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-25 22:34:46 +02:00
Havish
450842321d
Arc Length Algorithm (#7610)
* Create decimal_conversions.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create arc_length.py

* Delete decimal_conversions.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed redundant statement, fixed line overflow

* Update arc_length.py

Changed rad to radius as not to get confused with radians

* Update arc_length.py

* Update arc_length.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-25 21:47:52 +02:00
Caeden Perelli-Harris
393b960525
refactor: Replace doctest traceback with ... (#7558) 2022-10-23 16:36:10 +02:00
Pradyumn Singh Rahar
a3383ce3fd
Reduced Time Complexity to O(sqrt(n)) (#7429)
* Reduced Time Complexity to O(sqrt(n))

* Added testmod

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-23 17:56:40 +05:30
Arjit Arora
1bbb0092f3
Add signum function (#7526)
* Add signum function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add typehints for functions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update signum.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-23 13:17:30 +02:00
Caeden Perelli-Harris
a0cbc2056e
refactor: Make code more simple in maclaurin_series (#7522) 2022-10-23 13:01:51 +02:00
Akshit Gulyan
ed127032b3
Created sum_of_harmonic_series.py (#7504)
* Created sum_of_harmonic_series.py

Here in this code the formula for Harmonic sum is not used, Sum of the series is calculated by creating a list of the elements in the given Harmonic series and adding all the elements of that list !

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update maths/sum_of_harmonic_series.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/sum_of_harmonic_series.py

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

* Update maths/sum_of_harmonic_series.py

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

* Update maths/sum_of_harmonic_series.py

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

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update sum_of_harmonic_series.py

* Add doctests

* Update sum_of_harmonic_series.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-23 06:29:10 +02:00
Chris O
a5dd07c370
Maclaurin approximation of cos (#7507)
* renamed maclaurin_sin.py to maclaurin_series.py and included function for cos approximation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* attempt to fix pytest error

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-22 18:17:07 +02:00
Chris O
717f0e46d9
Maclaurin series approximation of sin (#7451)
* added maclaurin_sin.py function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added type hints and fixed line overflows

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed incompatable type examples

* Update maths/maclaurin_sin.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* changed error details

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed grammatical errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* improved function accuracy and added test case

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/maclaurin_sin.py

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

* removed redundant return

* fixed pytest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-21 09:03:57 +02:00
Kuldeep Borkar
50da472ddc
Implemented Gelu Function (#7368)
* Implemented Gelu Function

* Renamed file and added more description to function

* Extended the name GELU

* Update gaussian_error_linear_unit.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-19 19:18:33 +02:00
pre-commit-ci[bot]
0c7c5fa7b0
[pre-commit.ci] pre-commit autoupdate (#7387)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.0.0 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v3.0.0...v3.1.0)
- [github.com/codespell-project/codespell: v2.2.1 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.2.1...v2.2.2)

* updating DIRECTORY.md

* Fix typo discovered by codespell

* Fix typo discovered by codespell

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-17 21:59:25 +02:00
Advik Sharma
d728f5a96b
Added some more comments to volume.py in maths folder (#7080)
* Added some more comments

added some more comments (to formulas which need it) which make the code more readable and understandable. might make a list of all the formulas on the top, later

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* The order changes the result

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix long line

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-16 15:28:10 +02:00
Sagar Giri
e7b6d2824a
Change to https. (#7277)
* Change to https.

* Revert the py_tf file.
2022-10-16 09:43:29 +02:00
CenTdemeern1
04698538d8
Misc fixes across multiple algorithms (#6912)
Source: Snyk code quality
Add scikit-fuzzy to requirements

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 10:55:38 +05:30
Caeden
a652905b60
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
2022-10-15 19:29:42 +02:00
Caeden
6e69181d1f
refactor: Replace list() and dict() calls with literals (#7198) 2022-10-15 06:37:03 +05:30
Caeden
4d0c830d2c
Add flake8 pluin flake8 bugbear to pre-commit (#7132)
* ci(pre-commit): Add ``flake8-builtins`` additional dependency to ``pre-commit`` (#7104)

* refactor: Fix ``flake8-builtins`` (#7104)

* fix(lru_cache): Fix naming conventions in docstrings (#7104)

* ci(pre-commit): Order additional dependencies alphabetically (#7104)

* fix(lfu_cache): Correct function name in docstring (#7104)

* Update strings/snake_case_to_camel_pascal_case.py

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

* Update data_structures/stacks/next_greater_element.py

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

* Update digital_image_processing/index_calculation.py

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

* Update graphs/prim.py

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

* Update hashes/djb2.py

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

* refactor: Rename `_builtin` to `builtin_` ( #7104)

* fix: Rename all instances (#7104)

* refactor: Update variable names (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ci: Create ``tox.ini`` and ignore ``A003`` (#7123)

* revert: Remove function name changes (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename tox.ini to .flake8

* Update data_structures/heap/heap.py

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

* refactor: Rename `next_` to `next_item` (#7104)

* ci(pre-commit): Add `flake8` plugin `flake8-bugbear` (#7127)

* refactor: Follow `flake8-bugbear` plugin (#7127)

* fix: Correct `knapsack` code (#7127)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 18:03:06 +02:00
Caeden
d5a9f649b8
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003`

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 19:53:59 +05:30
Saksham Chawla
c73cb7e3f7
Add typing to maths/sum_of_arithmetic_series.py (#7065) 2022-10-13 12:48:28 +02:00
Saksham Chawla
9b0909d654
Add typing and snake casing to maths/decimal_isolate.py (#7066) 2022-10-13 12:47:52 +02:00
Saksham Chawla
7ad6c64029
Add typing to maths/add.py (#7064)
* Add typing to maths/add.py

https://stackoverflow.com/questions/50928592/mypy-type-hint-unionfloat-int-is-there-a-number-type

* Update add.py

* Update add.py
2022-10-13 11:45:20 +02:00
Caeden
07e991d553
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.py

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

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-13 00:54:20 +02:00
VARISH GAUTAM
e2cd982b11
Weird numbers (#6871)
* Create weird_number.py

In number theory, a weird number is a natural number that is abundant but not semiperfect

* check

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed

* Update weird_number.py

* Update weird_number.py

* Update weird_number.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-12 22:42:02 +02:00
Rohan R Bharadwaj
467ade28a0
Add surface area of cuboid, conical frustum (#6442)
* Add surface area of cuboid, conical frustum

* add tests for floats, zeroes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-12 20:48:49 +02:00
Saksham Chawla
32ff33648e
Add typing to maths/floor.py (#7056) 2022-10-12 20:42:30 +02:00
Saksham Chawla
74494d433f
Add typing to maths/ceil.py (#7057) 2022-10-12 20:41:52 +02:00
Saksham Chawla
2423760e1d
Add typing to maths/abs.py (#7060) 2022-10-12 20:41:01 +02:00
Rohan R Bharadwaj
922887c386
Add volume of hollow circular cylinder, Exceptions (#6441)
* Add volume of hollow circular cylinder, Exceptions

* Update volume.py

* floats, zeroes tests added

* Update volume.py

* f-strings
2022-10-12 20:34:01 +02:00
Saksham Chawla
f676055bc6
Add typing to maths/segmented_sieve.py (#7054) 2022-10-12 18:49:49 +02:00
Shubhajit Roy
f0d1a42deb
Python program for Carmicheal Number (#6864)
* Add files via upload

Python program to determine whether a number is Carmichael Number or not.

* Rename Carmichael Number.py to carmichael number.py

* Rename carmichael number.py to carmichael_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update carmichael_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create carmichael_number.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update maths/carmichael_number.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-12 09:22:23 +02:00
Jordan Rinder
5894554d41
Add Catalan number to maths (#6845)
* Add Catalan number to maths

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-08 23:28:17 +01:00
Daniel Pustotin
8b8fba3459
Improve code complexity for segmented sieve (#6372) 2022-10-02 17:35:02 +01:00
U
b3d9281591
Add algorithm for creating Hamming numbers (#4992)
* Added algorithm for creating Hamming numbers series in Python

* Changed to f-string format.

* Added modifications

* Update and rename hamming.py to hamming_numbers.py

* Update hamming_numbers.py

* Update hamming_numbers.py

* Rename maths/series/hamming_numbers.py to maths/hamming_numbers.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-07-17 05:55:29 +08:00
Dhruv Manilawala
38dfcd28b5
fix: test failures (#6250)
1. Incorrect function was being imported from the module
2. Testing for exception was not done correctly
2022-07-14 12:54:24 +05:30
lakshmikanth ayyadevara
dcc387631d
Improve prime_check in math modules (#6044)
* improved prime_check

* updating DIRECTORY.md

* included suggested changes

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 23:29:27 +08:00
Nikos Giachoudis
f7c58e4c4b
Unify primality checking (#6228)
* renames prime functions and occurances in comments

* changes implementation of primality testing to be uniform

* adds static typing as per conventions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 22:36:57 +08:00
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 (#6245)
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0

* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Nivid Patel
42a80cdaf6
Update basic_maths.py (#6017) 2022-06-22 12:04:18 +08:00
zer0-x
80f1da235b
Add sin function to maths (#5949)
* Add sin function to /maths.

* Fix typo in /maths/sin.py

* Format sin.py to meet the new black rules.

* Some improvements.

* Fix a formating error.
2022-05-16 19:28:30 +08:00
Omkaar
dbee5f072f
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py

* Update matrix_operation.py

* Update enigma_machine2.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update rod_cutting.py

* Update external_sort.py

* Update sol1.py

* Update hill_cipher.py

* Update prime_numbers.py

* Update integration_by_simpson_approx.py
2022-05-13 20:51:44 +08:00
Omkaar
e23c18fb5c
Fix typos (#6127) 2022-05-12 11:30:00 +08:00
Shuangchi He
e1ec661d4e
Fix some typos (#6113)
* Fix some typos.

* Update volume.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-01 18:44:23 +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
Lukas
7a9b3c7292
Added average absolute deviation (#5951)
* Added average absolute deviation

* Formats program with black

* reruns updated pre commit

* Update average_absolute_deviation.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-02-13 18:20:19 +01:00
zer0-x
637cf10555
Add points are collinear in 3d algorithm to /maths (#5983)
* Add points are collinear in 3d algorithm to /maths

* Apply suggestions from code review in points_are_collinear_3d.py

Thanks to cclauss.

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

* Rename some variables to be more self-documenting.

* Update points_are_collinear_3d.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-02-13 18:09:09 +01: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
Jaydeep Das
65d3cfff2f
Added memoization function in fibonacci (#5856)
* Added memoization function in fibonacci

* Minor changes
2021-11-28 19:20:18 +01:00
Christian Clauss
1ae5abfc3c
Replace typing.optional with new annotations syntax (#5829)
* Replace typing.optional with new annotations syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-17 04:43:02 +01:00
Bartechnika
9b9405fdcd
Add new persistence algorithm (#4751)
* Created new persistence algorithm

* Update persistence.py

* Added another persistence function
2021-11-13 17:32:44 +08:00
Rohan R Bharadwaj
a98465230f
[mypy] Fix type annotations for maths directory (#5782)
* [mypy] Fix annotations in `maths/series/p_series.py`

* Update p_series.py

* Update p_series.py

* Remove from excluded in mypy.ini

* Type annotation for series

* Annotate maths/proth_number.py (properly)

* Remove from excluded in mypy.ini

* Annotate average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Remove from excluded in mypy.ini

* Fix annotations in gamma_recursive.py

* Remove from excluded in mypy.ini

* Annotations for geometric_series.py

* Update geometric_series.py

* Update mypy.ini

* Update average_mode.py

* Update average_mode.py

* Update average_mode.py

* Update mypy.ini

* Update mypy.ini

* Update mypy.ini

* Update average_mode.py

* Update proth_number.py

* Update average_mode.py

* Update gamma_recursive.py

* Update proth_number.py

* Update mypy.ini

* Update geometric_series.py

* Update average_mode.py

* Update proth_number.py

* Update geometric_series.py

* Update geometric_series.py

* Update geometric_series.py

* Update p_series.py

* Update geometric_series.py

* Update p_series.py

* Update p_series.py

* Update geometric_series.py

* Update p_series.py

* Update p_series.py

* Remove data_structures/stacks/next_greater_element.py|

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-07 16:13:58 +01:00
Snimerjot Singh
7390777f9a
Added 2 shaped in volume.py (#5560) 2021-11-04 17:08:18 +01:00
Souvik Ghosh
0ea5c734e1
sock_merchant.py: Matching socks by color (#5761)
* Python file for finding number of pairs

* updating DIRECTORY.md

* fixed iterative_pair.py

* further fixed with type casting

* fixed naming conventions

* further fixed with naming convention

* documented done

* build issue fixed

* updating DIRECTORY.md

* Revert "documented done"

This reverts commit 3be15ca374.

* Update canny.py

* Update test_digital_image_processing.py

* Update sobel_filter.py

* requirements.txt fixed

* keras<2.7.0

* Update sock_merchant.py

* doctest with black fixed

* Update sock_merchant.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-03 21:24:50 +01:00
Matthew Wisdom
3c8fec1316
Add Neville's algorithm for polynomial interpolation (#5447)
* Added nevilles algorithm for polynomial interpolation

* Added type hinting for neville_interpolate function arguments.

* Added more descriptive names

* Update nevilles_method.py

* Fixed some linting issues

* Fixed type hinting error

* Fixed nevilles_method.py

* Add ellipsis for doctest spanning multiple lines

* Update nevilles_method.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-02 18:07:36 +08:00
Tianyi Zheng
84cca2119c
Rewrite maths/fibonacci.py (#5734)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

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

* Fix punctuation and wording

* Apply suggestions from code review

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

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

* Rewrite maths/fibonacci.py

* Rewrite timer and add unit tests

* Fix typos in fib_binet unit tests

* Fix typos in fib_binet unit tests

* Clean main method

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-01 18:06:35 +01:00
Tianyi Zheng
06ab650e08
Merge maths/fibonacci.py and maths/fibonacci_sequence_recursion.py (#5738)
* Rewrite parts of Vector and Matrix methods

* Refactor determinant method and add unit tests

Refactor determinant method to create separate minor and cofactor
methods.
Add respective unit tests for new methods.
Rename methods using snake case to follow Python naming conventions.

* Reorganize Vector and Matrix methods

* Update linear_algebra/README.md

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

* Fix punctuation and wording

* Apply suggestions from code review

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

* Deduplicate euclidean length method for Vector

* Add more unit tests for Euclidean length method

* Fix bug in unit test for euclidean_length

* Remove old comments for magnitude method

* Rewrite maths/fibonacci.py

* Rewrite timer and add unit tests

* Fix typos in fib_binet unit tests

* Fix typos in fib_binet unit tests

* Clean main method

* Merge fibonacci.py and fibonacci_sequence_recursion.py

* Fix fib_binet unit test

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-11-01 07:25:40 +01:00
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
Marcus T
5c8a6c8247
Add Pollard's Rho algorithm for integer factorization (#5598) 2021-10-29 01:53:39 +02:00
poloso
61e1dd27b0
[mypy] Fix type annotation in euler_method.py (#5649)
* [mypy] Fix type annotation in euler_method.py

In line with issue #4052.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-28 22:31:32 +02:00
Rohan R Bharadwaj
615c428903
Add doctest for exception (#5629)
* Add doctest for exception

* Spelling correction
2021-10-27 18:30:03 +02:00
Matteo Messmer
4eb5c12727
Sphere intersection and spherical cap volumes (#5579)
* sphere intersection + spherical cap volume formulas

* reformatted

* Update volume.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-27 00:28:26 +02:00
Leoriem-code
716beb32ed
Improved prime_numbers.py (#5592)
* Improved prime_numbers.py

* update prime_numbers.py

* Increase the timeit number to 1_000_000

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-26 09:21:44 +02:00
Christian Clauss
bd9464e4ac
mandelbrot.py: Commenting out long running tests (#5558)
* mandelbrot.py: Commenting out long running tests

* updating DIRECTORY.md

* Comment out 9 sec doctests

* Update bidirectional_breadth_first_search.py

* Comment out slow tests

* Comment out slow (9.15 sec) pytests...

* # Comment out slow (4.20s call) doctests

* Comment out slow (3.45s) doctests

* Update miller_rabin.py

* Update miller_rabin.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-23 18:15:30 +02:00
Murilo Gonçalves
07141e4bcc
Add doctests to prime_check function (#5503)
* added doctests to prime_check function

* fix doctests function name
2021-10-23 01:14:27 +08:00
poloso
fdf095f69f
[mypy] check polygon and corrections (#5419)
* Update annotations to Python 3.10 #4052

* Add floats doctest

* Copy list to avoid changing input unpredictably

* Refactor code to make it readable

* updating DIRECTORY.md

* Improve raised ValueErrors and add doctest

* Split doctest in multiples lines

* Change ValueError to Monogons and Digons are not poly

* Correct doctest refering number of sides

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-21 21:13:42 +08: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
Atharva Deshpande
1e64bf4600
Re-organize math/series (#5044)
* added harmonic mean

* Update maths/series/harmonic_mean.py

Updated the write-up of reference given in the code.

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

* changes in arithmetic and geometric mean code

* mean and series added in a single file

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-18 12:46:23 +08:00
Rohan R Bharadwaj
545fec7a14
Fix documentation (#5311) 2021-10-15 12:33:39 +02:00
Jordan Rinder
618f9ca885
Add Proth number to maths (#5246)
* Add Proth number to maths

* Add test for 0 and more informative output

* Fixing test failure issue - unused variable

* Update proth_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-14 16:30:52 +02:00
Rohan R Bharadwaj
d561de0bd9
Add surface area of cone and cylinder and hemisphere (#5220)
* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Update area.py
2021-10-14 13:23:18 +02:00