224 Commits

Author SHA1 Message Date
65cceae0be algorithm: signum (#1266) 2022-12-08 18:57:42 +05:30
18a91573c3 Added a new Maths algorithm to determine if two non-null integers are "friendly numbers" (#1267) 2022-11-30 16:51:08 +05:30
d6be3a4e96 algorithm: Hexagonal number (#1265) 2022-11-30 16:50:38 +05:30
640abcf468 fix: exchanging wrong path that breaks pipeline (#1262) 2022-11-02 13:54:05 +01:00
c39d6665ce algorithm: logarithmic square root (#1259)
* algorithm: add SquareRootLogarithmic algo and a test for it

* fix: fix spelling errors

* refactor: rename a variable "e" --> "edge"
2022-10-31 22:20:33 +05:30
35e1fe68d0 algorithm: add IntToBase algo and a test for it (#1258) 2022-10-31 22:19:14 +05:30
72ee63ca0f fix: build error due to FindLcm (#1223)
Co-authored-by: patrickwestervelt <pwestervelt3@gatech.edu>
2022-10-24 17:24:45 +05:30
8c27d86afc enhancement: FindLCM algorithm (#1222)
Co-authored-by: patrickwestervelt <pwestervelt3@gatech.edu>
2022-10-23 12:49:19 +05:30
6f9a8e4b5a added-ModularArithmetic-code (#1217)
* added-ModularArithmetic-code

* fix-typo

* suggested changes
2022-10-20 20:33:06 +05:30
73bf91d7e1 Add an algorithm to find Taylor series approximation of exponential f… (#1160) 2022-10-20 17:10:22 +05:30
0084acf2d4 algorithm: sieve (#1205) 2022-10-20 16:50:37 +05:30
4ce3dbe6b4 dependencies: update and clean (and auto-fix style issues) (#1195)
* Update npm dependencies (and auto-fix style issues)

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-16 16:09:56 +05:30
0df72642a5 algorithm: count the numbers divisible by ‘M’ in a given range (#1185)
*  test cases added for count divisible

*  count divisible math algorithm added

* style fixes
2022-10-15 14:52:44 +05:30
45f0b7cae6 algorithm: check if integer is palindrome (#1177)
* feat: Add check number case

* style: Fix formatting

* fix: Remove number check part

* feat: Create isPalindromeIntegerNumber

* test: Add minus number case
2022-10-15 14:44:44 +05:30
564ee8527a Add an algorithm to find mean absolute deviation (#1165) 2022-10-12 10:26:09 +05:30
109e4a685b algorithm: find length of an arc and area of the sector formed by an arc of a circle (#1119)
* Add an algorithm to find length and area of an arc of a circle

* Updated to follow Javascript Standard Style

* Update CircularArc.js

* Update CircularArc.js

* Add tests

* Followed Javascript standard style
2022-10-08 12:26:06 +05:30
c7f9bf961c algorithm: Square free integer (#1104)
* feat: Add square free integer implementation

* test: Add unit tests for square free integer

* refactor: Remove trailing whitespace from line 27

* refactor: Fix comments
2022-09-22 17:18:36 +05:30
d1152144aa algorithm: Liouville function (#1100) 2022-09-15 12:20:58 +05:30
644d7f7faa Binomial coefficient implementation (#1094) 2022-09-08 10:14:33 +05:30
61c9e8b372 fix: factorial function (#1093) 2022-09-07 15:00:35 +05:30
6f55ed4a1f algorithm: mobius function implementation (#1088)
* feat: Add mobius function implementation

* test: Add tests for mobius function

* fix: Code style fixes

* fix: Code style fixes

* fix: Store prime factors in a variable &  add throw error

* fix: Fix unit tests for zero and negative numbers

* fix: Minor code style fixes
2022-09-06 15:25:28 +05:30
ad41e8cc1c fix: spellings which are making ci fail (#1089)
* Updated Documentation in README.md

* chore: remove wrong spelling

* ci: recognize "falsy" as correct spelling

* chore: fix spelling

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-09-05 11:06:24 +05:30
979046897d merge: Edit Perfect{Square, Cube} (#1071)
* Make `PerfectCube` more correct and readable

* Add negative and Infinity tests

* Fixed comment formatting

* Realized BigInt support is unnecessary

The algorithm would be exactly the same, so there's no added educational value

* Update PerfectCube.js

* Remove space

* Update PerfectCube.js

Now `isInt` is replaced by `isFinite`, because `isInt` is a redundant check

* Update PerfectCube.js

Remove dot

* Parity between `PerfectSquare` and `PerfectCube`

* Update PerfectSquare.test.js

Fixed the old copy-paste error that said "cube" instead of "square". And added `Infinity` test
2022-08-12 23:14:25 +05:30
e9b8b136b9 merge: Implement Shor's factorization algorithm (#1070)
* Updated Documentation in README.md

* merge: Fix GetEuclidGCD (#1068) (#1069)

* Fix GetEuclidGCD

Implement the actual Euclidean Algorithm

* Replace == with ===

* Lua > JS

* Standard sucks

* Oops

* Update GetEuclidGCD.js

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>

* feat: implement Shor's Algorithm

* chore: add tests

* Updated Documentation in README.md

* chore: fix spelling

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-08-07 12:33:43 +05:30
cc16cbdf84 Added JugglerSequence.js (#1075) 2022-08-03 22:32:34 +05:30
1a089cc491 merge: Fix GetEuclidGCD (#1068)
* Fix GetEuclidGCD

Implement the actual Euclidean Algorithm

* Replace == with ===

* Lua > JS

* Standard sucks

* Oops

* Update GetEuclidGCD.js

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-27 18:43:07 +05:30
1b64ba68fa Fibonacci.js overhaul (#1049) 2022-06-27 10:09:54 +05:30
95a8ec08ed merge: More accurate error message at IsDivisible (#1048)
* More accurate error message

* Lowercased "R"
2022-06-21 22:47:45 +05:30
92a81a2290 merge: Add Twin Primes algorithm (#1024)
* Create TwinPrime.js

* Update TwinPrime.js

* Create TwinPrime.test.js

* Update TwinPrime.js

* Update TwinPrime.js

* Add suggestions

* Update TwinPrime.test.js

* Update TwinPrime.js

* Styling
2022-05-27 21:28:45 +05:30
0357a23282 merge: Add the Collatz Conjecture (#1022)
* Create CollatzConjecture.js

* Create CollatzConjecture.test.js

* Update CollatzConjecture.js

* Update CollatzConjecture.test.js

* Rename CollatzConjecture.js to CollatzSequence.js

* Update and rename CollatzConjecture.test.js to CollatzSequence.test.js

* Update CollatzSequence.js

* Update CollatzSequence.test.js

* Update CollatzSequence.test.js

* Fix styling errors

* Add suggestion

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>

* Update CollatzSequence.js

* Update CollatzSequence.js

* Update comments to match the Collatz Sequence

* Update CollatzSequence.test.js

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>
2022-05-26 08:37:53 +05:30
dc67506272 merge: Add pronic number implementation (#1023)
* feat: Add pronic number implementation

* Add test to Math

* Minor fixes

* Minor style fixes

* refactor: Store square root in a variable

* Minor refactoring

* fix: Change pronic number check logic

Reduced time complexity from O(sqrt(n)) to O(1)

* Minor style fixes

* fix: Update pronic number check boolean equation

* refactor: Change pronic number check condition

* refactor: Add tests to Math

* Minor style fixes

* refactor: Change unit test logic
2022-05-25 17:39:23 +05:30
21a851176d merge: Find max recursion (#1010)
* add yt video association algorithm

* Implement FindMaxRecursion in JS

* Delete file in other PR

* Fix requested changes

* Add requested changes

* Delete YoutubeVideoAssociation.test.js

* Deduplicate comment

* Remove trailing spaces

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-05-09 15:05:16 +05:30
5641b6faea Add Zeller's Congruence Algorithm in Math (#996) 2022-04-27 14:49:12 +02:00
c81db629b8 merge: EuclidGCD: add tests (#994)
test was not present beforehand.
2022-04-22 16:21:22 +05:30
9513bcd77a merge: WhileLoopFactorial: Optimize and add tests (#992)
* Optimised the factorial function.

There was previously an unnecessary check for if the number was 0 or 1.

* Create WhileLoopFactorial.test.js

The test was not present previously.

* result *= num

* Update WhileLoopFactorial.test.js

* testFactorial function

* Space for formatting.

* should fix the formatting issues. I was having trouble with npx standard, so I just used the online verifier at https://standardjs.com/demo.html
2022-04-21 21:58:29 +05:30
eb36e2de62 merge: Format codebase with standard.js (#989)
* Auto-update DIRECTORY.md

* fix: some redundancy according to standard javascript library

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-21 11:38:38 +05:30
8fc53906e6 merge: FindLCM: Improve code readablility (#985)
* fix: improving code readability

* fix: exchange break to return lcm

* fix: fixing condition for improve readability
2022-04-20 21:29:29 +05:30
2be0fdcb49 merge: Decimal Expansion (#787)
* Add Math function for representing the decimal expansion of a given fraction (decimal or any base from 2 to 10).

* Auto-update DIRECTORY.md

* DecimalExpansion Jest tests.

* chore: trigger update

* Auto-update DIRECTORY.md

* Auto-update DIRECTORY.md

* chore: trigger checks

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Rak Laptudirm <rak@laptudirm.com>
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2022-04-02 20:40:57 +05:30
b85bf49a35 merge: Fixed a wrong sentence structure (#952)
* Fixed a typo where the commenting was wrong

* optimised code

* fixed a sentence structure

* changed the sentence structure

* updated pull request

* Update SetBit.js
2022-03-27 22:43:21 +05:30
ffa4846994 merge: Add FindMinIterator algorithm (#928)
* FindMinIterator

Do the `standard` thing.

Rename `FindMin` to `FindMinIterator`

Rename to `FindMinIterator`

Pull `FindMin` from `master`

* Remove these separator comments.

Co-authored-by: RuSaG0 <mirzoev-ruslan-2000@mail.ru>
2022-03-16 17:31:25 +05:30
a545f76669 merge: Add test case of SquareRoot function (#926) 2022-03-15 20:39:34 +05:30
0924f1c8c9 merge: Improved abs function (#923)
* feat: added validation, test codes

* chore: remove useless words
2022-03-15 17:41:50 +05:30
da6c22704e merge: refactor isEven function (#920)
* refactor: formated docs and functions

* refactor: format all test codes
2022-03-11 22:16:02 +05:30
4f6fe1975c merge: resolve example mistake (#919) 2022-03-10 22:25:06 +05:30
98c46b4d9e merge: Improved IsOdd function (#914)
* refactor: used Boolean function for conversion

* feat: added one more function and test cases

* test: refactor test case & fixed var names

* chore: fixed test placeholder
2022-03-04 16:34:33 +05:30
ab06131656 merge: Improved Pow function (#911)
* feat: add negative power option

* docs: add js doc for powOn function

* feat: add PowFaster with faster algorithm, complexity O(logN)

* chore: rename to exponent

* chore: rename fixed

* style: formated with standard
2022-03-02 09:06:40 +05:30
0178efd8df merge: Algorithm to calculate the Arithmetic Geometric Mean (#897)
* Create ArithmeticGeometricMean.js

* Finally added the test script for AGM

* Better doc, and corrected some formatting

* Fixed syntax typos

* Added more tests and made FP comparison more "loose"

* Patched bugs

* Fixed-0 bug

* Again, tried to fix minus zero

* Finally fixed all bugs (probably)

* Fixed style (probably)

* Fixed style

* Fixed all style
2022-02-24 16:15:56 +05:30
743b3179f7 merge: Corrected JSdoc typo (#898)
The URL in the Wikipedia link had an extra "h" in the URI Scheme (the part that specifies the protocol, usually `https`). I removed the duplicate "h" and made it into a single "h", now the link works
2022-02-21 16:28:40 +05:30
49fa7d1a9b merge: improve median (#869)
* median

* [/pull/869] make fn pure

* [/pull/869/] pure averageMedian fn

* [/pull/869] formatter
2021-12-20 22:27:05 +05:30
ef832f6920 merge: add areaTriangleWithAllThreeSides method in Math/Area.js (#875) 2021-12-15 23:00:11 +05:30