Commit Graph

218 Commits

Author SHA1 Message Date
GOPISETTI NAVADEEP
c6880c195d feat: add Sieve of Eratosthenes algorithm (#7071)
* feat: add Sieve of Eratosthenes algorithm

- Implement Sieve of Eratosthenes for finding prime numbers up to n
- Add comprehensive unit tests with edge cases
- Include JavaDoc documentation
- Time complexity: O(n log log n)
- Space complexity: O(n)

Resolves #6939

* fix: remove trailing spaces

* fix: apply clang-format
2025-11-16 12:00:21 +00:00
Krishna
3979e824b7 Add Power of Four Check using bit manipulation (#7065)
* Add Power of Four Check using bit manipulation

- Implements isPowerOfFour method using bit manipulation
- Checks if number is power of two and has bit at even position
- Includes comprehensive unit tests
- Fixes #6940

* Fix code formatting in PowerOfFourTest

* Move PowerOfFour classes to maths package

* Fix package declaration in PowerOfFourTest

* Fix code formatting in PowerOfFourTest

* Remove redundant import from PowerOfFourTest

* Remove unrelated file
2025-11-15 18:36:01 +01:00
Taranjeet Singh Kalsi
98eecb9f16 Added program to check Smith number (#6955)
added smith number program
2025-11-15 09:32:06 +00:00
Lê Nam Khánh
f403ce66f9 chore: fix typos in src/main/java/com/thealgorithms/maths/BinomialCoefficient.java (#7036)
Fix typos in src/main/java/com/thealgorithms/maths/BinomialCoefficient.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:23:30 +00:00
Lê Nam Khánh
1645f31e79 chore: fix typos in src/main/java/com/thealgorithms/maths/SieveOfAtkin.java (#7037)
Fix typos in src/main/java/com/thealgorithms/maths/SieveOfAtkin.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:16:55 +00:00
Priyanshu Kumar Singh
08374248e9 [FEAT] Add Coulomb's Law for electrostatics (#7017)
Co-authored-by: Priyanshu1303d <priyanshu130d@gmail.com>
2025-11-01 09:28:44 +00:00
JonathanButterworth
dfd8d6993f Added surface area calculation for pyramid (#6853)
Co-authored-by: JonathanButterworth <JonathanButterworth>
2025-10-30 21:26:22 +00:00
Keykyrios
68746f880f feat: Add Chebyshev Iteration algorithm (#6963)
* feat: Add Chebyshev Iteration algorithm

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* update

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java

* Update ChebyshevIteration.java

* Update ChebyshevIterationTest.java
2025-10-28 17:43:54 +02:00
Keykyrios
3c70a54355 feat: Add Neville's Algorithm (#6842)
* feat: Add Neville's algorithm for polynomial interpolation

* Update Neville.java

* style: Fix linter formatting issues.

* Handled Div by Zero Case

* Update NevilleTest.java

* Update Neville.java

* Update NevilleTest.java

* Update Neville.java
2025-10-28 10:14:59 +00:00
Hardik Pawar
f8688ba38d refactor: Enhance docs, code, add tests in Means (#6750) 2025-10-15 09:14:00 +00:00
Hardik Pawar
c6497a23ec refactor: Enhance docs, code, add tests in LucasSeries (#6749) 2025-10-15 09:07:49 +00:00
Hardik Pawar
f460c601d3 refactor: Enhance docs, code, add tests in HeronsFormula (#6746)
* refactor: Enhance docs, code, add tests in `HeronsFormula`

* Fix lint
2025-10-15 08:56:57 +00:00
Hardik Pawar
d62b438fcd refactor: Enhance docs, code, add tests in HarshadNumber (#6745) 2025-10-15 08:46:17 +00:00
Hardik Pawar
219cc33588 refactor: Enhance docs, code, add tests in `LinearDiophantineEquation… (#6744)
refactor: Enhance docs, code, add tests in `LinearDiophantineEquationsSolver`
2025-10-15 08:42:16 +00:00
Hardik Pawar
f30d10117d refactor: Enhance docs, code, add tests in LeonardoNumber (#6743) 2025-10-13 07:42:10 +00:00
Hardik Pawar
387ecef310 refactor: Enhance docs, code, add tests in KeithNumber (#6748)
* refactor: Enhance docs, code, add tests in `KeithNumber`

* Fix

---------

Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-12 23:37:24 +02:00
Hardik Pawar
297634d05f refactor: Enhance docs, code, add tests in KaprekarNumbers (#6747)
Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-12 23:13:14 +02:00
Hardik Pawar
ff9fd2e2e4 refactor: Enhance docs, code, add tests in Median (#6751)
Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-12 22:51:54 +02:00
Hardik Pawar
74ddea6747 refactor: Enhance docs, code, add tests in KrishnaMurthyNumber (#6742)
* refactor: Enhance docs, code, add tests in `KrishnaMurthyNumber`

* Lint
2025-10-12 20:04:32 +00:00
Banula Kumarage
61fbb1855c Dev: Add Zeller's Congruence utility class to calculate the day of the week (#6614)
* Add Zeller's Congruence utility class and unit tests

* fixed identified bugs

* fixed pmd failure
2025-10-09 20:36:20 +02:00
Ruturaj Jadhav
3c071c4e08 Added HappyNumber algorithm in maths section (#6571)
* Added HappyNumber algorithm in maths section

* Fix Checkstyle: remove trailing spaces in HappyNumber

* Fix formatting: remove trailing spaces and apply clang-format

* Update HappyNumberTest.java

* Removed old HappyNumbersSeq.java as replaced by new HappyNumber.java
2025-10-09 17:31:56 +00:00
Banula Kumarage
e788111420 Dev: Added Germain and Safe prime utility class (#6611)
* feat: add Germain and Safe prime utility class with unit tests

* refactor the code

* fixed identified bugs

* fixed identified remaining bugs

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-10-09 17:28:06 +00:00
Saahil Mahato
061463a4df feat: add sieve of atkin algorithm (#6709)
* feat: add sieve of atkin algorithm

* fix: add full test coverage

* refactor: if condition braces

---------

Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-08 20:18:17 +02:00
Yash Rajput
b031a0bbba Adding PiApproximation algo (#6602)
* Adding PiApproximation algo

* Added clang formatting

* Added private method

* checkstyle fix

* checkstyle fix

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-10-08 12:16:14 +00:00
Saahil Mahato
9f985b2549 feat: add euler primality test (#6680)
* feat: add euler primality test

* refactor: use fixed seed

* fix: more unit test coverage

* fix: add mock tests for edge cases

* fix: styling issues

* refactor: remove duplicate tests

* refactor: reduce static imports

* refactor: remove unnecessary tests

* refactor: move to maths package

---------

Co-authored-by: a <alexanderklmn@gmail.com>
2025-10-06 20:23:32 +02:00
Banula Kumarage
6d5170999a Dev: Added NumberPersistence utility class to find multiplicative and additive persistance (#6612)
* Add NumberPersistence utility class with multiplicative and additive persistence methods

* Fixed identified style issues
2025-10-04 12:55:26 +02:00
Sriram kulkarni
d8ddb07b7e Added Sum of Squares Lagrange's Four Square algorithm implementation (#6583)
* Add Sum of Squares algorithm implementation

* Format code and add Wikipedia URL for Lagrange's theorem

* Fixed clang-format issues

---------

Co-authored-by: Oleksandr Klymenko <alexanderklmn@gmail.com>
2025-10-02 10:44:36 +03:00
Oleksandr Klymenko
31bf130e9e refactor: improving Median (#6404)
refactor: improving Median

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-20 08:21:46 +00:00
Oleksandr Klymenko
434ab50ff4 refactor: Convolution (#6382)
refactor: Convolution

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-16 15:05:13 +00:00
Oleksandr Klymenko
d55e89dc71 refactor: Mode (#6381)
refactor: Mode
2025-07-16 17:02:16 +02:00
Oleksandr Klymenko
933e929b54 refactor: refactor Ceil and improved tests (#6366)
* refactor: refactor Ceil and improved tests

* checkstyle: remove redundant import

* refactor: fix edge cases

* refactor: fix checkstyle

* refactor: fix checkstyle import order
2025-07-14 07:47:22 +02:00
Oleksandr Klymenko
dba2d869f2 refactor: improving GenericRoot (#6365)
refactor: improving GenericRoot
2025-07-12 06:51:49 +00:00
Oleksandr Klymenko
fa2ca9db39 refactor: improve PythagoreanTriple logic and add parameterized tests (#6350) 2025-07-08 00:29:52 +03:00
Deniz Altunkapan
1745d19f09 refactor: unified duplicate Anagram classes into a single implementation (#6290) 2025-06-11 20:04:06 +03:00
Piotr Idzik
0072ed9aa7 style: do not suppress lossy-conversions (#6206) 2025-03-31 19:20:58 +02:00
Hakim's Garage
769e4975f6 Add Parenthesis to MathBuilder (#6193) 2025-03-14 22:34:03 +02:00
Hakim's Garage
e6073f8fef Add math builder (#6190) 2025-03-12 18:35:21 +02:00
varada610
4ef06822ca Create package prime, matrix and games (#6139) 2025-01-27 11:10:41 +00:00
Muhammad Rizwan
0e0539ea6c Fix AbsoluteMin bug for equal absolute values (#6145)
* fix-absolute-max-bug

* clang-format for added junit

* fix-absolute-min-bug
2025-01-19 17:50:43 +01:00
Muhammad Rizwan
30d0c064a7 Fix absolute max bug (#6144) 2025-01-18 21:51:56 +02:00
BILLSARAN
754bf6c5f8 Add Goldbach's Conjecture algorithm (#6127) 2025-01-13 23:37:58 +02:00
Patient_Pace_Coder
779381f902 Update Armstrong (#6131) 2025-01-13 10:04:08 +02:00
Piotr Idzik
a9633c0000 style: include ICAST_IDIV_CAST_TO_DOUBLE (#6121) 2025-01-10 20:50:09 +02:00
Stanislav Belogolov
14db275c2b Improve Vampire Number (#6110) 2025-01-01 22:43:00 +00:00
Strange Developer
df0c997e4b General performance improvement (#6078) 2024-11-01 19:52:42 +02:00
Muhammad Junaid Khalid
d1c1e6b4d2 Add uniform number counting algorithm (#6052) 2024-10-29 17:46:29 +00:00
Taranjeet Singh Kalsi
921821214f Add a new method to check Perfect Square (#5917) 2024-10-26 11:30:33 +00:00
Taranjeet Singh Kalsi
95875b0ae4 Add another method to find kth number (#5918) 2024-10-26 11:26:01 +00:00
Taranjeet Singh Kalsi
871e4df0d9 Add another method to check Pronic number (#5919) 2024-10-26 11:19:16 +00:00
UTSAV SINGHAL
1577ec4e62 Add Catalan number (#5846) 2024-10-26 10:10:20 +00:00