Kushal997-das / SkillShow

Welcome to the SkillShow repository! This is a collaborative space for beginners and intermediate programmers to showcase their skills through coding tasks and portfolio submissions. 💻✨
https://kushal997-das.github.io/SkillShow/
MIT License
28 stars 39 forks source link

Title: Count Prime Numbers #58

Open dikshat25 opened 2 weeks ago

dikshat25 commented 2 weeks ago

Initiative (Required)

Hacktoberfest 2024 🎃

Is your feature request related to a problem? Please describe.

Given an integer n, return the number of prime numbers that are strictly less than n. The problem is to determine how many prime numbers exist that are strictly less than a given integer 𝑛

Describe the solution you'd like.

To solve this problem efficiently, we can use the Sieve of Eratosthenes algorithm To solve this problem efficiently, we can use the Sieve of Eratosthenes algorithm. This algorithm involves creating a boolean array where each index represents whether the number corresponding to that index is prime. We start by initializing all entries to true (indicating that all numbers are potential primes), except for indices 0 and 1, which are not prime. We then iterate through the array, starting from the first prime number (2). For each prime number found, we mark all of its multiples as not prime. Finally, we count the number of true values remaining in the array, which will give us the total number of primes less than n

Add any other context or screenshots about the feature request here.

No response

github-actions[bot] commented 2 weeks ago

@dikshat25

It's great having you contribute to this project

Thanks for opening this Issue 🙌 , Welcome to SkillShow 💖 We will review everything and get back to you.
Make sure to give a star to this repo before making a fork! Thank you :)

dikshat25 commented 2 weeks ago

Please assign this issue to me under the hacktober fest