Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Solution for Summation of primes Problem #115

Merged
merged 3 commits into from
Oct 1, 2023

Conversation

varundeepsaini
Copy link
Contributor

Added a Java solution for finding the sum of all prime numbers below a given integer, N, as described in #53 , utilizing the Sieve of Eratosthenes algorithm for optimized prime number generation and summation.
Changes

  • Added a Solution.java file which contains a method sumPrimes(int n) that returns the sum of all prime numbers below a given integer n.
  • Added a Test.java file which includes a test suite that validates the solution for correctness. The test case with the known answer 17 (for n = 10) has passed successfully in local testing.
  • Added a Readme.md file which explains the problem statement in detail.

Details

  • Time Complexity: O(n * log(log n))
  • Space Complexity: O(n)

@varundeepsaini
Copy link
Contributor Author

@probablyArth Please start the Testing

@probablyArth probablyArth added the java-problem-solution Add new java solution label Oct 1, 2023
Copy link
Contributor

@probablyArth probablyArth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@probablyArth probablyArth merged commit 953676b into SST-OSS:main Oct 1, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java-problem-solution Add new java solution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants